contracts: Charge rent for code storage (#7935)

* contracts: Implement refcounting for wasm code

* contracts: Charge rent for code storage

* contracts: Fix dispatchables erroneously refunding base costs

* Fixed typos in comments.

Co-authored-by: Andrew Jones <ascjones@gmail.com>

* Remove awkward empty line

* Fix more typos in docs

* Fix typos in docs

Co-authored-by: Andrew Jones <ascjones@gmail.com>

* Split up complicated expression

Co-authored-by: Andrew Jones <ascjones@gmail.com>

* review: Remove unused return value

* Fix typos

Co-authored-by: Andrew Jones <ascjones@gmail.com>

* review: Fix refcount being reset to one on re-instrumentation

* Document evictable_code parameter

* Make Executable::execute consume and store itself

* Added comments about stale values

* Disregard struct size in occupied_storage()

Co-authored-by: Andrew Jones <ascjones@gmail.com>
This commit is contained in:
Alexander Theißen
2021-02-04 12:01:34 +01:00
committed by GitHub
parent 5569313bd6
commit 8e49a8a6a6
17 changed files with 1903 additions and 1529 deletions
+3 -7
View File
@@ -42,23 +42,19 @@ fails, A can decide how to handle that failure, either proceeding or reverting A
### Dispatchable functions
* `put_code` - Stores the given binary Wasm code into the chain's storage and returns its `code_hash`.
* `instantiate` - Deploys a new contract from the given `code_hash`, optionally transferring some balance.
This instantiates a new smart contract account and calls its contract deploy handler to
initialize the contract.
* `call` - Makes a call to an account, optionally transferring some balance.
Those are documented in the reference documentation of the `Module`.
## Usage
The Contract module is a work in progress. The following examples show how this Contract module
can be used to instantiate and call contracts.
* [`ink`](https://github.com/paritytech/ink) is
- [`ink`](https://github.com/paritytech/ink) is
an [`eDSL`](https://wiki.haskell.org/Embedded_domain_specific_language) that enables writing
WebAssembly based smart contracts in the Rust programming language. This is a work in progress.
## Related Modules
* [Balances](https://docs.rs/pallet-balances/latest/pallet_balances/)
- [Balances](https://docs.rs/pallet-balances/latest/pallet_balances/)
License: Apache-2.0