There're some smart contracts that only checks whether certain conditions are met. On the other hand, there're some other contracts that keep some state and the state changes by transactions calling them.
Assume we have a smart contract simulating some token, like here. So the contract only keeps a balance (who has how much), which is an array: balance = [b_1, b_2...].
Then, each time person A transfers some token to B, the balance is changed (i.e. the value corresponding to A decreases and for B increases in "balance" array).
I think we need to make a transaction and request such token transfer.
Question: Where and How is the new state (e.g. balance) stored?
Am I right that the new state of the contract is a part of the transaction invoking it, so new state is stored in the block containing this transaction?