package tezos-protocol-015-PtLimaPt
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=ad9e08819871c75ba6f4530b125f7d157799398e4d77a1e6bfea9d91ff37ff55
sha512=c5dc4d40cc09bc6980fbbdb5c2e105bf4252cf9cfcb2b49660b0ebe4dc789f6709ec3b3bf2f87d81580d3eed9521eeb1c960f24d9b14eb0285aaba1f84d10a9b
doc/tezos-protocol-015-PtLimaPt.raw/Tezos_raw_protocol_015_PtLimaPt/Delegate_storage/Contract/index.html
Module Delegate_storage.Contract
Source
This module ensures the following invariants:
- registered delegates (i.e. those that appear in
Storage.Delegates
) are self-delegated, that is a delegate's implicit account delegates to itself (i.e.Contract_delegate_storage.find
delegate
returnsdelegate
), - registered delegates have their public keys revealed,
- registered delegates cannot change their delegation,
- stake is properly moved when changing delegation.
type Tezos_protocol_environment_015_PtLimaPt.Error_monad.error +=
| Active_delegate
| Empty_delegate_account of Tezos_protocol_environment_015_PtLimaPt.Signature.Public_key_hash.t
| No_deletion of Tezos_protocol_environment_015_PtLimaPt.Signature.Public_key_hash.t
| Current_delegate
val init :
Raw_context.t ->
Contract_repr.t ->
Tezos_protocol_environment_015_PtLimaPt.Signature.Public_key_hash.t ->
Raw_context.t Tezos_protocol_environment_015_PtLimaPt.Error_monad.tzresult
Tezos_protocol_environment_015_PtLimaPt.Lwt.t
init ctxt contract delegate
registers a delegate when creating a contract.
This functions assumes that contract
is allocated.
This function returns the Unregistered_delegate
error if contract
already has a delegate or if delegate
is not a registered delegate.
val set :
Raw_context.t ->
Contract_repr.t ->
Tezos_protocol_environment_015_PtLimaPt.Signature.Public_key_hash.t option ->
Raw_context.t Tezos_protocol_environment_015_PtLimaPt.Error_monad.tzresult
Tezos_protocol_environment_015_PtLimaPt.Lwt.t
set ctxt contract delegate_opt
allows to set the delegate of a contract to delegate
when delegate_opt = Some delegate
or to unset the delegate when delegate_opt = None
. When delegate_opt = Some contract
(aka self-delegation), the function also registers the contract as a delegate and sets the delegate as active.
It returns the Unregistered_delegate
error when self-delegating and when the public key is not yet revealed. It returns the Empty_delegate_account
error when self-delegating and the implicit account is not allocated. It returns the Active_delegate
error when self-delegating and the delegate is already active. It returns the Unregistered_delegate
error when trying to set the delegate to an unregistered delegate. It returns the Current_delegate
error when contract is already delegated to the same delegate. It returns the No_deletion
error when trying to unset or change the delegate of a registered delegate.