https://github.com/make-software/casper-event-standard
The smart contract level events for Casper Network.
https://github.com/make-software/casper-event-standard
blockchain blockchain-technology casper-network ces smart-contracts
Last synced: about 1 year ago
JSON representation
The smart contract level events for Casper Network.
- Host: GitHub
- URL: https://github.com/make-software/casper-event-standard
- Owner: make-software
- License: apache-2.0
- Created: 2023-01-24T18:01:07.000Z (over 3 years ago)
- Default Branch: release/0.5.0
- Last Pushed: 2025-01-21T11:09:07.000Z (over 1 year ago)
- Last Synced: 2025-03-28T02:03:56.255Z (about 1 year ago)
- Topics: blockchain, blockchain-technology, casper-network, ces, smart-contracts
- Language: Rust
- Homepage: https://crates.io/crates/casper-event-standard
- Size: 47.9 KB
- Stars: 6
- Watchers: 5
- Forks: 7
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# Casper Event Standard
The Casper Event Standard is a Rust library that provides a simple and standardized way for smart contracts on the Casper Network to emit events. Events are an important tool for decentralized applications, as they allow contracts to communicate with external services in a transparent and decentralized way.
With the Casper Event Standard, developers can easily define custom event types and register them in the contract. The library provides a convenient API for emitting events. This makes it easy to build complex applications that rely on event-driven architecture.
Whether you're building a decentralized exchange, a prediction market, or any other type of blockchain application, the Casper Event Standard is an essential tool for creating reliable and scalable smart contracts. So why wait? Start using the Casper Event Standard today and take your decentralized application to the next level!
## Usage
```rust
use casper_event_standard::Event;
// Turn a struct into an event.
#[derive(Event)]
struct Transfer {
amount: U256,
from: Key,
to: Key
}
// Register event schemas.
fn init_events() {
let schemas = Schemas::new()
.with::();
casper_event_standard::init(schemas);
}
// Emit event.
fn emit_transfer(transfer: Transfer) {
casper_event_standard::emit(transfer);
}
```
## Tests
To test the code run:
```bash
$ just test
```