morley-client-0.4.0: Client to interact with the Tezos blockchain
Safe HaskellSafe-Inferred
LanguageHaskell2010

Morley.Client.Action.Delegation

Synopsis

Documentation

setDelegateOp :: (HasTezosRpc m, HasTezosClient m, MonadReader env m, HasLog env Message m) => ImplicitAddressWithAlias -> Maybe KeyHash -> m OperationHash Source #

Set or revoke a delegate for the sender. To set a supply Just delegate as the second argument. To withdraw a delegate supply Nothing as the second argument.

Some notes on delegations:

Implicit Accounts can either be registered delegates, have no delegate, or have a delegate set without being registered delegates themselves.

For example imagine two implicit addresses Alice and Bob: * Alice registers as delegate using registerDelegateOp. This means that Alice delegates to Alice. * Bob sets Alice as his delegate. This delegates Bob's staking rights to Alice.

Now, Alice can't change their delegate, because that would revoke Alice as delegate and make Bob's delegation void. So setDelegateOp alice Nothing would throw a FailedUnDelegation alice exception.

However, Bob, not beeing a registered delegate can: * Revoke the delegation to alice setDelegateOp bob Nothing * Delegate to another "registered delegate": registerDelegateOp charly >> setDelegateOp bob charly * Become a registered delegate himself: registerDelegateOp bob

Smart Contracts can also delegate to registered delegates, but can't be registered delegates themselves.

registerDelegateOp :: (HasTezosRpc m, HasTezosClient m, MonadReader env m, HasLog env Message m) => ImplicitAddressWithAlias -> m OperationHash Source #

Register the sender as its delegate and become a "registered delegate" Alias for setDelegateOp sender (Just sender)