Formulas & derived params
๐ Draft. This chapter has not been reviewed yet โ content may be incomplete or change.
Problem. Compute amounts, indices, and parameter values from other values instead of hard-coding them.
๐ง This recipe is a stub. Outline of what it will cover:
- Where formulas appear: output/input
amount_sat, validationexpr, hooksetvalues, witnessexpr.- Operators (
+ - * /, comparisons,&& || !) and references (compile_params.X,params.X,input_id.amount_sat,input_id.asset,input_id.present).- Functions:
pow(base, exp),index_of(id),concat(...).- The special
feesvalue used in change formulas.- Derived params (
"derived": true): interest =PRINCIPAL_AMOUNT * PRINCIPAL_INTEREST_RATE / 10000, and params derived from issuance outpoints.
See Spec.md ยง9
for the formula grammar in the meantime.