From 213acd3d4f514fc5d6b52578f95eede943349bef Mon Sep 17 00:00:00 2001 From: huianyang Date: Wed, 7 Dec 2022 11:10:28 -0500 Subject: [PATCH] docs: added documentation for drain delegate operation re #2068 --- docs/drain_delegate.md | 21 +++++++++++++++++++ website/sidebars.js | 1 + website/sidebars.json | 1 + .../version-15.0.0/drain_delegate.md | 21 +++++++++++++++++++ 4 files changed, 44 insertions(+) create mode 100644 docs/drain_delegate.md create mode 100644 website/versioned_docs/version-15.0.0/drain_delegate.md diff --git a/docs/drain_delegate.md b/docs/drain_delegate.md new file mode 100644 index 0000000000..d9056f6530 --- /dev/null +++ b/docs/drain_delegate.md @@ -0,0 +1,21 @@ +--- +title: Drain Delegate +author: Hui-An Yang +--- + +## Drain Delegate +This is an operation that must be signed by the active consensus key `consensus_pkh` of the baker `baker_pkh`. This operation immediately transfers all the spendable balance of the `baker_pkh`’s implicit account into the `destination_pkh` implicit account. It has no effect on the frozen balance. This operation is included in pass 2 (anonymous operations). So drain operations don’t compete with regular manager operations for gas and block size quota; the 1M restriction (one-operation-per-manager-per-block) applies to drain operations as well, meaning that a drain for a baker and a transfer operation from the same baker are in conflict. As an incentive for bakers to include drain operations, a fixed fraction of the drained baker’s spendable balance is transferred as fees to the baker that includes the operation, i.e. the maximum between 1tz or 1% of the spendable balance. + +### Examples +```typescript +const drain = await Tezos.contract.drainDelegate({ + consensus_key: 'CONSENSUS_PKH', + delegate: 'BAKER_PKH', + destination: 'DESTINATION_PKH', +}); +await drain.confirmation(); +``` + +- `consensus_key` is the public key hash of updated consensus key +- `delegate` is the public key hash of the baker/delegate +- `destination` is the public key hash of the destination account diff --git a/website/sidebars.js b/website/sidebars.js index 309058611c..c7e726c028 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -32,6 +32,7 @@ const sidebars = { 'confirmation_event_stream', 'set_delegate', 'dapp_prelaunch', + 'drain_delegate', 'estimate', 'subscribe_event', 'fa2_parameters', diff --git a/website/sidebars.json b/website/sidebars.json index e587c273dd..c9993f90f8 100644 --- a/website/sidebars.json +++ b/website/sidebars.json @@ -14,6 +14,7 @@ "confirmation_event_stream", "set_delegate", "dapp_prelaunch", + "drain_delegate", "estimate", "fa2_parameters", "lambda_view", diff --git a/website/versioned_docs/version-15.0.0/drain_delegate.md b/website/versioned_docs/version-15.0.0/drain_delegate.md new file mode 100644 index 0000000000..d9056f6530 --- /dev/null +++ b/website/versioned_docs/version-15.0.0/drain_delegate.md @@ -0,0 +1,21 @@ +--- +title: Drain Delegate +author: Hui-An Yang +--- + +## Drain Delegate +This is an operation that must be signed by the active consensus key `consensus_pkh` of the baker `baker_pkh`. This operation immediately transfers all the spendable balance of the `baker_pkh`’s implicit account into the `destination_pkh` implicit account. It has no effect on the frozen balance. This operation is included in pass 2 (anonymous operations). So drain operations don’t compete with regular manager operations for gas and block size quota; the 1M restriction (one-operation-per-manager-per-block) applies to drain operations as well, meaning that a drain for a baker and a transfer operation from the same baker are in conflict. As an incentive for bakers to include drain operations, a fixed fraction of the drained baker’s spendable balance is transferred as fees to the baker that includes the operation, i.e. the maximum between 1tz or 1% of the spendable balance. + +### Examples +```typescript +const drain = await Tezos.contract.drainDelegate({ + consensus_key: 'CONSENSUS_PKH', + delegate: 'BAKER_PKH', + destination: 'DESTINATION_PKH', +}); +await drain.confirmation(); +``` + +- `consensus_key` is the public key hash of updated consensus key +- `delegate` is the public key hash of the baker/delegate +- `destination` is the public key hash of the destination account