Beispiel #1
0
        public IEnumerator GetModel(MonoBehaviour owner)
        {
            yield return(GetNumModels(owner));

            var keccak = new Sha3Keccak();
            var d      = keccak.CalculateHash("getModel(uint256)");

            d = d.Substring(0, 8);

            // get latest model
            var value = EthereumAbiUtil.EncodeInt32(numModels - 1);

            string data = EncodeData("0x" + d + value);

            Request req = new Request(owner, Get <Call>("eth_call", data));

            yield return(req.Coroutine);

            Call response = req.result as Call;

            modelResponse = new GetModelResponse(response.result);

            Debug.LogFormat("Model {0}, {1}. {2}, {3}, {4}", modelResponse.address,
                            modelResponse.bounty, modelResponse.initialError, modelResponse.targetError,
                            modelResponse.configAddress);
        }
Beispiel #2
0
        public IEnumerator GetNumModelGrads(MonoBehaviour owner, int modelId)
        {
            var keccak = new Sha3Keccak();
            var d      = keccak.CalculateHash("getNumGradientsforModel(uint256)");

            d = d.Substring(0, 8);

            var value = EthereumAbiUtil.EncodeInt32(modelId);

            string data = EncodeData("0x" + d + value);

            Request req = new Request(owner, Get <Call>("eth_call", data));

            yield return(req.Coroutine);

            Call response = req.result as Call;

            var numGrads = (int)new System.ComponentModel.Int32Converter().ConvertFromString(response.result);

            Debug.LogFormat("\nNum Models Grads: {0}", numGrads.ToString("N"));
        }
Beispiel #3
0
        public IEnumerator GetModel(MonoBehaviour owner)
        {
            yield return(GetNumModels(owner));

            var keccak = new Sha3Keccak();
            var d      = keccak.CalculateHash("getModel(uint256)");

            d = d.Substring(0, 8);

            // get latest model
            var value = EthereumAbiUtil.EncodeInt32(numModels - 1);

            string data = EncodeData("0x" + d + value);

            Request req = new Request(owner, Get <Call>("eth_call", data));

            yield return(req.Coroutine);

            Call response = req.result as Call;

            modelResponse = new GetModelResponse(response.result);
        }