[contracts] Add ext_tombstone_deposit (#4722)

* [contracts] add ext_tombstone_deposit

* [contracts] update tombstone_deposit docs
This commit is contained in:
Hero Bird
2020-01-23 15:13:49 +01:00
committed by Sergei Pepyakin
parent 81004eabfd
commit 389b8f1698
4 changed files with 92 additions and 0 deletions
@@ -623,6 +623,23 @@ define_env!(Env, <E: Ext>,
Ok(())
},
// Stores the tombstone deposit into the scratch buffer.
//
// The data is encoded as T::Balance. The current contents of the scratch
// buffer are overwritten.
//
// # Note
//
// The tombstone deposit is on top of the existential deposit. So in order for
// a contract to leave a tombstone the balance of the contract must not go
// below the sum of existential deposit and the tombstone deposit. The sum
// is commonly referred as subsistence threshold in code.
ext_tombstone_deposit(ctx) => {
ctx.scratch_buf.clear();
ctx.ext.tombstone_deposit().encode_to(&mut ctx.scratch_buf);
Ok(())
},
// Decodes the given buffer as a `T::Call` and adds it to the list
// of to-be-dispatched calls.
//