示例#1
0
        public void Convert()
        {
            var contract          = ContractParser.FromDasFile("C:\\Users\\Johny\\Downloads\\mortgage.dascontract");
            var contractConverter = new ContractConverter(contract);

            contractConverter.ConvertContract();
            File.WriteAllText("C:\\Users\\Johny\\Downloads\\mortgage.sol", contractConverter.GetSolidityCode());
        }
示例#2
0
        public void TestConversion()
        {
            var contract = ElectionContractFactory.CreateContract();

            var contractConverter = new ContractConverter(contract);

            contractConverter.ConvertContract();
            var solidityCode = contractConverter.GetSolidityCode();

            System.IO.File.WriteAllText(@"../../../../DasContract.CaseStudies/elections/elections.sol", solidityCode);
        }
        public bool TryConvertContract(Contract contract, out string data)
        {
            ContractConverter converter = new ContractConverter(contract);

            try
            {
                converter.ConvertContract();
                data = converter.GetSolidityCode();
                return(true);
            }
            catch (Exception e)
            {
                data = e.Message;
                return(false);
            }
        }
 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);
     }
 }