message: [examples/erc20] Add missing flushing functionality
  For now kept super ugly but it should work at least ...
diff: #![no_std]
  use pdsl_core::{
  - storage::{
  - self,
  - Key,
  - alloc::ForwardAlloc,
  - },
  + storage,
  env::{Env, ContractEnv, srml::Address, srml::Balance},
  };
  use parity_codec::{Encode, Decode};
  @@ -94,6 +90,16 @@ impl Erc20Token {
  }
  }
  +// BELOW THIS EVERYTHING WILL EVENTUALLY BE GENERATED BY THE eDSL
  +
  +use pdsl_core::{
  + storage::{
  + alloc::ForwardAlloc,
  + Flush,
  + Key,
  + },
  +};
  +
  impl Erc20Token {
  /// Creates new ERC-20 token using the given allocator.
  pub unsafe fn new_using_alloc<A>(alloc: &mut A) -> Self
  @@ -108,6 +114,14 @@ impl Erc20Token {
  }
  }
  +impl Flush for Erc20Token {
  + fn flush(&mut self) {
  + self.balances.flush();
  + self.allowances.flush();
  + self.total_supply.flush();
  + }
  +}
  +
  /// Erc20Token API.
  #[derive(Encode, Decode)]
  enum Action {
  @@ -144,22 +158,34 @@ pub extern "C" fn call() {
  let mut erc20token = unsafe { Erc20Token::new_using_alloc(&mut alloc) };
  match action {
  Action::TotalSupply => {
  - ret(erc20token.total_supply())
  + let ret_val = erc20token.total_supply();
  + erc20token.flush();
  + ret(ret_val);
  }
  Action::BalanceOf{owner} => {
  - ret(erc20token.balance_of(owner))
  + let ret_val = erc20token.balance_of(owner);
  + erc20token.flush();
  + ret(ret_val);
  }
  Action::Allowance{owner, spender} => {
  - ret(erc20token.allowance(owner, spender))
  + let ret_val = erc20token.allowance(owner, spender);
  + erc20token.flush();
  + ret(ret_val);
  }
  Action::Transfer{to, value} => {
  - ret(erc20token.transfer(to, value))
  + let ret_val = erc20token.transfer(to, value);
  + erc20token.flush();
  + ret(ret_val);
  }
  Action::Approve{spender, value} => {
  - ret(erc20token.approve(spender, value))
  + let ret_val = erc20token.approve(spender, value);
  + erc20token.flush();
  + ret(ret_val);
  }
  Action::TransferFrom{from, to, value} => {
  - ret(erc20token.transfer_from(from, to, value))
  + let ret_val = erc20token.transfer_from(from, to, value);
  + erc20token.flush();
  + ret(ret_val);
  }
  }
  }
  