Declare the protocol state you were given: internal ether, internal shares and external shares for one or more snapshots. The node recomputes the holder balance, wrap and unwrap amounts, the round-trip loss and its exact bound, rebases between snapshots (negative ones included) and fee dilution. Every conversion rounds down. Nothing is read from a chain, so the result is only as good as the numbers you declare.