casper_event

Crates.iocasper_event
lib.rscasper_event
version0.1.0
sourcesrc
created_at2021-10-15 15:41:25.602353
updated_at2021-10-15 15:41:25.602353
descriptionLibrary for developing Casper smart contracts with event.
homepagehttps://casper.network
repositoryhttps://github.com/Murasame233/casper-event
max_upload_size
id465550
size9,732
Murasame (Murasame233)

documentation

README

Intro

this project is a lib that makes developer can easily use event on their smart contract.

how to

Event Provider

#[no_mangle]
fn call(){
    ...
    let mut entry = EntryPoints::new();
    if let (entry_set: EntryPoint,entry_unset: EntryPoint) = get_set_event_entry(){
        entry.add_entry_point(entry_set);
        entry.add_entry_point(entry_unset);
    }
    let mut named_keys = NamedKeys::new();
    named_keys.append(&mut get_set_event_named_keys())
    new_contract(entry, named_keys, _, _);
    ...
}

// when you have a event to evoke
    ...
    send_event("event_name".into(),Some(target),Some(target_entry),runtime_args!{})
    ...

Event User

// You need a entry to handle the event
#[no_mangle]
fn handler(){
    ...
}

// set event callback
    ...
    set_event_callback("handler".into(),contract_hash,callback_entry,target_hash);
    ...
Commit count: 15

cargo fmt