Part of #1055. Split methods, as they have a lot of common code. This also fixex nil error of storageGetReadOnlyContext in case when contract does not have storage.