autonity / docs.autonity.org

Documentation for the Autonity Go Client (AGC)
https://docs.autonity.org
2 stars 5 forks source link

Add state transition diagrams for NTN & LNTN #7

Open cmjc opened 1 year ago

cmjc commented 1 year ago

Description

NTN has states too, and they correspond exactly to LNTN states b/c they share the same state transitions. How about displaying this logic visually with a pair of synchronised state machine diagrams:

ntn-state-machine

dot code for reference:

digraph finite_state_machine {
    graph [nodesep=1];
    fontname="Courier-Bold"
    {
    rank=same;
    node [shape = doublecircle, fixedsize=true, width=1.25, height=1.25, xlabel = "NTN"]; unbonded;
    node [shape = circle, fixedsize=true, width=1.25, height=1.25, xlabel=""];
    unbonded -> bonded [label = "bond"];
    bonded -> unbonding [label = "unbond"];
    unbonding -> unbonded;
    }

    {
    style = filled;
    rank=same;
    node [shape = doublecircle, fixedsize=true, width=1.25, height=1.25, label="unminted/\nburned", xlabel = "LNTN"] unminted; 
    node [shape = circle, fixedsize=true, width=1.25, height=1.25, label="locked", xlabel=""] locked; 
    node [shape = circle, fixedsize=true, width=1.25, height=1.25, label="unlocked"] unlocked; 
    unminted -> unlocked [label = "bond"];
    unlocked -> locked [label = "unbond"];
    locked -> unminted;
    }

    unbonded -> unminted [style="invis"];
    bonded -> unlocked [style="invis"];
    unbonding -> locked [style="invis"];

}   

Rationale

Visualisation will improve readability and clarity of the docs. Adding diagrams to the baseline docs is a known To Do not yet actioned.

Tasks

cmjc commented 1 year ago

Choose diagramming language

Options seems to be:

Hugo References:

Docsy References:

GraphViz References:

cmjc commented 1 year ago

Enable digramming in website

GraphViz:

Mermaid:

PlantUML: