Skip to content

Commit

Permalink
Test out new interface api
Browse files Browse the repository at this point in the history
  • Loading branch information
ascjones committed May 5, 2022
1 parent 8b393f3 commit 0081544
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 25 deletions.
25 changes: 0 additions & 25 deletions crates/lang/tests/ui/contract/pass/event-shared-external.rs

This file was deleted.

40 changes: 40 additions & 0 deletions crates/lang/tests/ui/contract/pass/interface-with-event.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
use ink_lang as ink;

#[ink::interface]
pub mod contract_interface {
#[ink(trait_definition)]
pub trait ContractInterface {
#[ink(constructor)]
fn constructor() -> Self;

#[ink(message)]
fn message(&self, value: bool) {}
}

#[ink(event)]
pub enum Event {
MessageInvoked { value: bool }
}
}

#[ink::contract]
mod contract {
use super::contract_interface;

#[ink(storage)]
pub struct Contract {}

impl contract_interface::ContractInterface for Contract {
#[ink(constructor)]
fn constructor() -> Self {
Self {}
}

#[ink(message)]
fn message(&self, value: bool) {
self.env().emit_event(contract_interface::Event::MessageInvoked { value })
}
}
}

fn main() {}

0 comments on commit 0081544

Please sign in to comment.