public override bool Convert(Contract contract)
 {
     try
     {
         var converter = new ContractConverter(contract);
         converter.ConvertContract();
         ConvertedCode = converter.GetSolidityCode();
         ErrorMessage  = null;
         return(true);
     }
     catch (Exception e)
     {
         ConvertedCode = null;
         ErrorMessage  = e.Message;
         return(false);
     }
 }
Beispiel #2
0
        public static string PropertyTypeToString(Property property, ContractConverter contractConverter)
        {
            var type = property.DataType;

            //Get the datatype name if reference
            string typeAsString;

            if (type == PropertyDataType.Reference)
            {
                typeAsString = contractConverter.GetDataType(property.ReferencedDataType).ToStructureName();
            }
            else
            {
                typeAsString = PrimitivePropertyTypeToString(type);
            }

            if (property.PropertyType == PropertyType.Collection)
            {
                typeAsString += "[]";
            }
            return(typeAsString);
        }
Beispiel #3
0
 public ContractService(IUnitOfWork uow)
 {
     _uow       = uow;
     _converter = new ContractConverter();
 }
Beispiel #4
0
 public ContractConverterShould()
 {
     _converter = new ContractConverter();
 }