# Adaptive Issuance Walkthrough notes This document is an extended note from going through [Nicolas Ochem's hackmd document](https://hackmd.io/@nicolasochem/BypPmEgon) and will also reference [Inna's Notion document](https://www.notion.so/ecad/TAQUITO-Adaptive-issuance-impact-5ea19d98b398487e9810890b88840089) on Adaptive Issuance's impact in Taquito. ## Impact on Taquito Taquito will most likely support the main change on AI (Adaptive Issuance), which are the `stake`, `unstake`, and `finalize_unstake` 'psuedo-entrypoints'. ### Staking Assuming your baker accepts third party stakers, we can stake our tez using this command: ``` octez-client transfer 1000 from staker0 to staker0 --entrypoint stake ``` This will result in this operation on when injected: ```json { "kind": "transaction", "source": "tz1L3k4mf4QPUVaqGAAMYYWkDegEzBtVC12L", "fee": "623", "counter": "1075", "gas_limit": "3630", "storage_limit": "0", "amount": "1000000000", "destination": "tz1L3k4mf4QPUVaqGAAMYYWkDegEzBtVC12L", "parameters": { "entrypoint": "stake", "value": { "prim": "Unit" } }, "metadata": { "balance_updates": [ ... ], "operation_result": { ... } } } ``` - Note that the `stake` entrypoint results in a `transaction` operation with specific values under the`parameters` property ### Unstaking Staking rewards are always frozen until you unstake, and unstaking can be accomplished using this command: ``` octez-client transfer 0 from staker0 to staker0 --entrypoint unstake --arg "9999999999999" ``` - Currently unsure about what `arg` represents, it seems like an arbitrary value. Will need to confirm This command will result in this operation when injected on the chain: ```json { "kind": "transaction", "source": "tz1L3k4mf4QPUVaqGAAMYYWkDegEzBtVC12L", "fee": "687", "counter": "1076", "gas_limit": "4250", "storage_limit": "0", "amount": "0", "destination": "tz1L3k4mf4QPUVaqGAAMYYWkDegEzBtVC12L", "parameters": { "entrypoint": "unstake", "value": { "int": "9999999999999" } }, "metadata": { "balance_updates": [ ... ], "operation_result": { ... } } ``` ### Finalize unstake Once your tez is unstaked, you stop accruing staking rewards but you're still slashable for 5 cycles (7 on mainnet). The tez is now in a 'unstaked but frozen' balance. Once the slashing window has passed, you can 'finalize' the balance using the `finalize_unstake` pseudo-operation. ``` octez-client transfer 0 from staker0 to staker0 --entrypoint finalize_unstake ``` result on chain: ```json { "kind": "transaction", "source": "tz1g9n5aKK9CeTZEaYgh5uHq6ZqLzS4eU5T5", "fee": "429", "counter": "930", "gas_limit": "1729", "storage_limit": "0", "amount": "0", "destination": "tz1g9n5aKK9CeTZEaYgh5uHq6ZqLzS4eU5T5", "parameters": { "entrypoint": "finalize_unstake", "value": { "prim": "Unit" } }, "metadata": { "balance_updates": [ ... ], "operation_result": { ... } } ``` ## Work in Taquito ### Feature Implementation From Inna's notion doc, Taquito will want to support the 3 main pseudo-operations (stake, unstake, finalize_unstake. There are also a good number of changes for protocol constants and RPC endpoints that are there to support this feature. More details about them will be in the form of issues on Github. From a high level, Taquito can support those similar to doing a `contractCall` method, where it's essentially a method wrapper for injecting transaction operations with extra parameters. The details will need to be fleshed out in a further discussion with the team. ### Testing Another hurdle to clear is the testing approach. We will need to consider these things: - a baker needs to be pre-configured to accept 3rd party stakers, with enough balance - figure out how to circumvent the number of cycles it needs to clear for when you stake, unstake, and finalize_unstake