Add ExtCurrentBlockNumber in SRML::Contract (#3047)

* add block number

* add ext_current_block

* add ext_current_block test

* Update srml/contracts/src/wasm/mod.rs

Co-Authored-By: Sergei Pepyakin <s.pepyakin@gmail.com>

* Update srml/contracts/src/wasm/mod.rs

Co-Authored-By: Sergei Pepyakin <s.pepyakin@gmail.com>

* change valid comment

* use BlockNumberOf<T>

* Update srml/contracts/src/exec.rs

Co-Authored-By: André Silva <andre.beat@gmail.com>

* return types copy, not reference

* version up spec_version and impl_version

* change method name current_block -> block_number

* Update srml/contracts/src/exec.rs

Co-Authored-By: Sergei Pepyakin <s.pepyakin@gmail.com>
This commit is contained in:
satellitex
2019-07-10 21:42:36 +09:00
committed by Sergei Pepyakin
parent 0366f7b35c
commit e9d41feb1c
3 changed files with 84 additions and 0 deletions
@@ -701,6 +701,13 @@ define_env!(Env, <E: Ext>,
}
Ok(())
},
// Stores the current block number of the current contract into the scratch buffer.
ext_block_number(ctx) => {
ctx.scratch_buf.clear();
ctx.ext.block_number().encode_to(&mut ctx.scratch_buf);
Ok(())
},
);
/// Finds duplicates in a given vector.