예제 #1
0
        public ContractScript(IMicheline script)
        {
            if (!(script is MichelineArray array) || array.Count < 3)
            {
                throw new FormatException("Invalid micheline");
            }

            var parameter = array.FirstOrDefault(x => (x as MichelinePrim)?.Prim == PrimType.parameter) as MichelinePrim
                            ?? throw new FormatException("Invalid micheline parameters");

            var storage = array.FirstOrDefault(x => (x as MichelinePrim)?.Prim == PrimType.storage) as MichelinePrim
                          ?? throw new FormatException("Invalid micheline storage");

            Parameter = new ContractParameter(parameter);
            Storage   = new ContractStorage(storage);
        }
예제 #2
0
 public ContractScript(IMicheline parameter, IMicheline storage)
 {
     Parameter = new ContractParameter(parameter);
     Storage   = new ContractStorage(storage);
 }