What exactly does append_variable_outputs do

Take a look at this forum post for more information on what variable outputs are.

OutputVariables: This output type indicates that the output’s amount and owner may vary based on transaction execution, but is otherwise identical to a Coin output. An amount of zero after transaction execution indicates that the output is unspendable and can be pruned from the UTXO set.

Whenever you do ANY transfers to an address that determines the value being set. Take a look at this AMM function for adding liquidity. After the user adds liquidity the contract transfers back two tokens.

  1. LP token representing their position in the pool
  2. Either token A or token B that was not used up. Never both.

Since that is two transfers within the test here for adding liquidity the value is set to be 2.

Hope this adds some clarity for you! :slight_smile:

1 Like