Alpha: Non implicit contracts cannot be removed

This commit is contained in:
Pierre Chambart 2018-06-01 17:36:32 +02:00 committed by Benjamin Canou
parent 64481a198e
commit 2404246fb3

View File

@ -235,18 +235,22 @@ let create_implicit c manager ~balance =
~spendable:true ~delegatable:false ~spendable:true ~delegatable:false
let delete c contract = let delete c contract =
Delegate_storage.remove c contract >>=? fun c -> match Contract_repr.is_implicit contract with
Storage.Contract.Balance.delete c contract >>=? fun c -> | None ->
Storage.Contract.Manager.delete c contract >>=? fun c -> (* For non implicit contract Big_map should be cleared *)
Storage.Contract.Spendable.del c contract >>= fun c -> failwith "Non implicit contracts cannot be removed"
Storage.Contract.Delegatable.del c contract >>= fun c -> | Some _ ->
Storage.Contract.Counter.delete c contract >>=? fun c -> Delegate_storage.remove c contract >>=? fun c ->
Storage.Contract.Code.remove c contract >>=? fun (c, _) -> Storage.Contract.Balance.delete c contract >>=? fun c ->
Storage.Contract.Storage.remove c contract >>=? fun (c, _) -> Storage.Contract.Manager.delete c contract >>=? fun c ->
Storage.Contract.Paid_storage_space_fees.remove c contract >>= fun c -> Storage.Contract.Spendable.del c contract >>= fun c ->
Storage.Contract.Used_storage_space.remove c contract >>= fun c -> Storage.Contract.Delegatable.del c contract >>= fun c ->
Storage.Contract.Big_map.clear (c, contract) >>=? fun (c, _) -> Storage.Contract.Counter.delete c contract >>=? fun c ->
return c Storage.Contract.Code.remove c contract >>=? fun (c, _) ->
Storage.Contract.Storage.remove c contract >>=? fun (c, _) ->
Storage.Contract.Paid_storage_space_fees.remove c contract >>= fun c ->
Storage.Contract.Used_storage_space.remove c contract >>= fun c ->
return c
let allocated c contract = let allocated c contract =
Storage.Contract.Counter.get_option c contract >>=? function Storage.Contract.Counter.get_option c contract >>=? function