コード例 #1
0
        private void SerializeRulesEngineToBlockchain()
        {
            WonkaRefEnvironment RefEnv = WonkaRefEnvironment.GetInstance();

            // Creating an instance of the rules engine using our rules and the metadata
            moRulesEngine =
                new WonkaBreRulesEngine(new StringBuilder(msRulesContents), moMetadataSource);

            var contract = GetContract();

            var hasRuleTreeFunction = contract.GetFunction(CONST_CONTRACT_FUNCTION_HAS_RT);

            // Out of gas exception
            // var gas = new Nethereum.Hex.HexTypes.HexBigInteger(1000000);

            var gas = hasRuleTreeFunction.EstimateGasAsync(this.msSenderAddress).Result;

            bool bTreeAlreadyExists =
                hasRuleTreeFunction.CallAsync <bool>(this.msSenderAddress, gas, null, this.msSenderAddress).Result;

            if (!bTreeAlreadyExists)
            {
                moRulesEngine.Serialize(msSenderAddress, msPassword, msSenderAddress, msContractAddress, msAbiWonka);
            }
        }
コード例 #2
0
        private void SerializeRulesEngineToBlockchain(WonkaBreRulesEngine poEngine)
        {
            var contract = GetContract();

            var hasRuleTreeFunction = contract.GetFunction(CONST_CONTRACT_FUNCTION_HAS_RT);

            var gas = hasRuleTreeFunction.EstimateGasAsync(this.msSenderAddress).Result;

            bool bTreeAlreadyExists =
                hasRuleTreeFunction.CallAsync <bool>(this.msSenderAddress, gas, null, this.msSenderAddress).Result;

            if (!bTreeAlreadyExists)
            {
                poEngine.Serialize(msSenderAddress, msPassword, msSenderAddress, msContractAddress, msAbiWonka);
            }
        }
コード例 #3
0
        protected virtual void SerializeRulesEngineToBlockchain()
        {
            var contract = GetContract();

            var hasRuleTreeFunction = contract.GetFunction(CONST_CONTRACT_FUNCTION_HAS_RT);

            // Out of gas exception
            var gas = hasRuleTreeFunction.EstimateGasAsync(BlockchainEngineOwner).Result;
            // var gas = new Nethereum.Hex.HexTypes.HexBigInteger(1000000);

            bool bTreeAlreadyExists =
                hasRuleTreeFunction.CallAsync <bool>(BlockchainEngineOwner, gas, null, BlockchainEngine.SenderAddress).Result;

            if (!bTreeAlreadyExists)
            {
                moRulesEngine.Serialize(BlockchainEngineOwner,
                                        BlockchainEngine.Password,
                                        BlockchainEngine.SenderAddress,
                                        BlockchainEngine.ContractAddress,
                                        BlockchainEngine.ContractABI,
                                        null,
                                        msWeb3HttpUrl);
            }
        }