implement contract events (#2161)

* implement contract events

* update runtime

* renaming

* update test code hash

* improve complexity details

* add deposit event base cost

* add test

* Revert "add deposit event base cost"

This reverts commit 58ec010c0f4f4f0e16935ad41da32aedd17a8c57.

* update test

* Revert "update test"

This reverts commit 6fe61a593ccf0d41f09a0b97472b28ed8751a999.

* Revert "Revert "add deposit event base cost""

This reverts commit 145e8a9bac15313a4c380aa66b94fd4d36fa3f6d.

* Fix format a bit
This commit is contained in:
thiolliere
2019-04-03 08:20:01 +02:00
committed by Gav Wood
parent e6cc49cf63
commit c98db99d80
8 changed files with 117 additions and 10 deletions
+7 -1
View File
@@ -89,7 +89,6 @@ pub trait Ext {
/// Returns a reference to the account id of the current contract.
fn address(&self) -> &AccountIdOf<Self::T>;
/// Returns the balance of the current contract.
///
/// The `value_transferred` is already added.
@@ -103,6 +102,9 @@ pub trait Ext {
/// Returns a reference to the random seed for the current block
fn random_seed(&self) -> &SeedOf<Self::T>;
/// Deposit an event.
fn deposit_event(&mut self, data: Vec<u8>);
}
/// Loader is a companion of the `Vm` trait. It loads an appropriate abstract
@@ -617,6 +619,10 @@ where
fn now(&self) -> &T::Moment {
&self.timestamp
}
fn deposit_event(&mut self, data: Vec<u8>) {
self.ctx.events.push(RawEvent::Contract(self.ctx.self_account.clone(), data));
}
}
/// These tests exercise the executive layer.