contracts: Reduce the API surface (#8359)

* contracts: Remove types and storage from the public interface

* contracts: Remove current_schedule() getter

* contracts: Improve documentation

* Update README.md

* Fix integration test
This commit is contained in:
Alexander Theißen
2021-03-24 09:09:19 +01:00
committed by GitHub
parent d343683ca9
commit d98a3c7942
14 changed files with 256 additions and 238 deletions
@@ -47,6 +47,12 @@
//! induces. In order to be able to charge the correct weight for the functions defined
//! by a chain extension benchmarks must be written, too. In the near future this crate
//! will provide the means for easier creation of those specialized benchmarks.
//!
//! # Example
//!
//! The ink! repository maintains an
//! [end-to-end example](https://github.com/paritytech/ink/tree/master/examples/rand-extension)
//! on how to use a chain extension in order to provide new features to ink! contracts.
use crate::{
Error,
@@ -141,8 +147,8 @@ pub enum RetVal {
/// Grants the chain extension access to its parameters and execution environment.
///
/// It uses the typestate pattern to enforce the correct usage of the parameters passed
/// to the chain extension.
/// It uses [typestate programming](https://docs.rust-embedded.org/book/static-guarantees/typestate-programming.html)
/// to enforce the correct usage of the parameters passed to the chain extension.
pub struct Environment<'a, 'b, E: Ext, S: state::State> {
/// The actual data of this type.
inner: Inner<'a, 'b, E>,
@@ -376,6 +382,8 @@ mod state {
pub trait BufIn: State {}
pub trait BufOut: State {}
/// The initial state of an [`Environment`](`super::Environment`).
/// See [typestate programming](https://docs.rust-embedded.org/book/static-guarantees/typestate-programming.html).
pub enum Init {}
pub enum OnlyIn {}
pub enum PrimInBufOut {}