public void ConvertLogic()
        {
            tokenContract = new SolidityContract(token.ToStructureName());
            tokenContract.AddInheritance(ConverterConfig.OWNABLE_NAME);
            //constructor
            tokenContract.AddComponent(CreateConstructor());
            //mint
            tokenContract.AddComponent(CreateMintFunction());
            //transfer
            tokenContract.AddComponent(CreateTransferFunction());
            dataModelConverter.AddDependency(ConverterConfig.OWNABLE_IMPORT);
            if (token.IsFungible)
            {
                tokenContract.AddInheritance(ConverterConfig.FUNGIBLE_TOKEN_NAME);
                dataModelConverter.AddDependency(ConverterConfig.FUNGIBLE_TOKEN_IMPORT);
            }
            else
            {
                tokenContract.AddInheritance(ConverterConfig.NON_FUNGIBLE_TOKEN_NAME);
                dataModelConverter.AddDependency(ConverterConfig.NON_FUNGIBLE_TOKEN_IMPORT);
            }

            foreach (var property in token.Properties)
            {
                tokenContract.AddComponent(dataModelConverter.ConvertProperty(property));
            }
        }
Example #2
0
        public void TestMultipleInheritance()
        {
            SolidityContract contract = new SolidityContract("foo");

            contract.AddInheritance("Bar1");
            contract.AddInheritance("Bar2");

            var actual   = contract.ToString();
            var expected = "contract foo is Bar1, Bar2{ \n }";

            Assert.Equal(expected, actual);
        }