Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed compilation errors
  • Loading branch information
xgreenx committed Dec 11, 2022
commit 8e136503820d3b84081ba6fa0d12a16e7f6e163d
5 changes: 2 additions & 3 deletions crates/env/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,12 @@ where
}

/// Emits an event with the given event data.
pub fn emit_event<E, Event>(event: Event)
pub fn emit_event<Event>(event: Event)
where
E: Environment,
Event: Topics + scale::Encode,
{
<EnvInstance as OnInstance>::on_instance(|instance| {
TypedEnvBackend::emit_event::<E, Event>(instance, event)
TypedEnvBackend::emit_event::<Event>(instance, event)
})
}

Expand Down
3 changes: 1 addition & 2 deletions crates/env/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,9 +401,8 @@ pub trait TypedEnvBackend: EnvBackend {
/// # Note
///
/// For more details visit: [`emit_event`][`crate::emit_event`]
fn emit_event<E, Event>(&mut self, event: Event)
fn emit_event<Event>(&mut self, event: Event)
where
E: Environment,
Event: Topics + scale::Encode;

/// Invokes a contract message and returns its result.
Expand Down
3 changes: 1 addition & 2 deletions crates/env/src/engine/off_chain/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,9 +426,8 @@ impl TypedEnvBackend for EnvInstance {
})
}

fn emit_event<E, Event>(&mut self, event: Event)
fn emit_event<Event>(&mut self, event: Event)
where
E: Environment,
Event: Topics + scale::Encode,
{
let builder = TopicsBuilder::default();
Expand Down
8 changes: 4 additions & 4 deletions crates/env/src/engine/on_chain/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,13 +401,13 @@ impl TypedEnvBackend for EnvInstance {
self.get_property_little_endian::<E::Balance>(ext::minimum_balance)
}

fn emit_event<E, Event>(&mut self, event: Event)
fn emit_event<Event>(&mut self, event: Event)
where
E: Environment,
Event: Topics + scale::Encode,
{
let (mut scope, enc_topics) =
event.topics::<E, _>(TopicsBuilder::from(self.scoped_buffer()).into());
let (mut scope, enc_topics) = event.topics(
TopicsBuilder::<<Event as Topics>::Env>::from(self.scoped_buffer()).into(),
);
let enc_data = scope.take_encoded(&event);
ext::deposit_event(enc_topics, enc_data);
}
Expand Down
2 changes: 1 addition & 1 deletion crates/ink/src/env_access.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ where
where
Event: ink_env::Topics + scale::Encode,
{
ink_env::emit_event::<E, Event>(event)
ink_env::emit_event::<Event>(event)
}

/// Instantiates another contract.
Expand Down