Interpreter should allow for contracts from multiple sources
Clarification and motivation
Currently, our interpreter assumes that there is a given finite set of the originated contracts (grep for Map ContractAddress ContractState
) in the context, and usually this set is either empty or comes from a database used by Morley CLI tool.
In debugger we have a use case for putting contracts from various sources into the interpretation context, see morley-debugger#31. We want to support at least:
- All contracts from a given chain (e.g. https://ithaca.testnet.tezos.serokell.team)
- Contract from the given file
What we want from Morley is to generalize the set of originated contract so that the debugger could implement the points mentioned above.
Probably ceContracts :: Map ContractAddress ContractState
in ContractEnv
should be replaced with ceContracts :: ContractAddress -> IO (Maybe ContractState)
. Doing the same for gsContractAddresses
in GState
is not necessary at the moment, and it would be problematic given that it has a JSON instance.
Keep in mind that joining multiple sources of contracts is a common operation and should be exported in some way.
If morley-client provides means of obtaining that contracts getter by chain (probably ChainId
for well-known chains or BaseUrl
for custom chains like Serokell testnet), that would be just great.
Acceptance criteria
- When using
Morley.Michelson.Interpreter.interpret
function, I can supply some external source of contracts like an entire testnet, and these contracts will be available forCONTRACT
andVIEW
instructions. - A can add a few additional contracts (e.g. coming from Lorentz) with the given balance and storage to that source.