Пример #1
0
        async Task test_getStructConfig()
        {
            var result = await oracleSw_Com.api_InvokeScript(shash, "getStructConfig");

            oracleSw_Com.ResultItem   item  = result.value;
            oracleSw_Com.ResultItem[] items = item.subItem;

            Console.WriteLine("items = ", items);

            if (items != null)
            {
                Console.WriteLine("from:" + ThinNeo.Helper.GetAddressFromScriptHash(items[0].AsHash160()));
                Console.WriteLine("liquidate_line_rate_b:" + items[1].AsHashString());
                Console.WriteLine("liquidate_line_rate_c:" + items[2].AsHashString());
                Console.WriteLine("liquidate_dis_rate_c:" + items[3].AsInteger());
                Console.WriteLine("fee_rate_c:" + items[4].AsInteger() + " PNEO");
                Console.WriteLine("liquidate_top_rate_c:" + items[5].AsInteger() + " SDUSD");
                Console.WriteLine("liquidate_line_rateT_c:" + items[6].AsInteger());
                Console.WriteLine("issuing_fee_c:" + items[6].AsInteger());
                Console.WriteLine("issuing_fee_b:" + items[6].AsInteger());
                Console.WriteLine("debt_top_c:" + items[6].AsInteger());
            }
            else
            {
                Console.WriteLine("no txInfo exists");
            }
        }
Пример #2
0
        async Task test_getTypeB()
        {
            Console.WriteLine("Input key:");
            string key = Console.ReadLine();

            ThinNeo.Hash160 shash  = new ThinNeo.Hash160(Config.sc_oracle);
            var             result = await oracleSw_Com.api_InvokeScript(shash, "getTypeB", "(str)" + key);

            Console.WriteLine("result = " + result);

            oracleSw_Com.ResultItem item = result.value;

            if (item != null)
            {
                byte[] data = item.data;

                BigInteger value = new BigInteger(data);

                Console.WriteLine(key + ":" + value);
            }
            else
            {
                Console.WriteLine("item is null");
            }
        }
Пример #3
0
        //获取配置
        async Task test_getTestData()
        {
            Console.WriteLine("Input index:");
            string index = Console.ReadLine();

            Console.WriteLine("Input key:");
            string key = Console.ReadLine();

            //Console.WriteLine("Input keyIndex:");
            //string keyIndex = Console.ReadLine();

            Console.WriteLine("Input addr:");
            string addr = Console.ReadLine();

            //Console.WriteLine("Input value:");
            //string price = Console.ReadLine();
            ThinNeo.Hash160 shash = new ThinNeo.Hash160(Config.sc_oracle);

            var result = await oracleSw_Com.api_InvokeScript(shash, "test", "(int)" + index, "(str)" + key, "(addr)" + addr);

            oracleSw_Com.ResultItem item = result.value;

            if (item != null)
            {
                byte[] data = item.data;

                BigInteger value = new BigInteger(data);

                Console.WriteLine(key + ":" + value);
            }
            else
            {
                Console.WriteLine("item is null");
            }
        }
Пример #4
0
        async Task test_getAddrWithConfigs()
        {
            Console.WriteLine("Input addr:");
            string key = Console.ReadLine();

            var result = await oracleSw_Com.api_InvokeScript(shash, "getAddrWithConfigs", "(addr)" + key);

            oracleSw_Com.ResultItem item = result.value;

            if (item != null)
            {
                byte[] data = item.data;
            }
            else
            {
                Console.WriteLine("item is null");
            }
        }
Пример #5
0
        async Task test_getApprovedAddr()
        {
            Console.WriteLine("Input key:");
            string key = Console.ReadLine();

            ThinNeo.Hash160 shash  = new ThinNeo.Hash160(Config.sc_oracle);
            var             result = await oracleSw_Com.api_InvokeScript(shash, "getApprovedAddrs", "(str)" + key);

            oracleSw_Com.ResultItem item = result.value;

            if (item != null)
            {
                byte[] data = item.data;
            }
            else
            {
                Console.WriteLine("item is null");
            }
        }
Пример #6
0
        async Task test_getAnchorPrice()
        {
            Console.WriteLine("Input key:");
            string key    = Console.ReadLine();
            var    result = await oracleSw_Com.api_InvokeScript(shash, "getAnchorPrice", "(str)" + key);

            oracleSw_Com.ResultItem item = result.value;

            if (item != null)
            {
                byte[] data = item.data;

                BigInteger value = new BigInteger(data);

                Console.WriteLine(key + ":" + value);
            }
            else
            {
                Console.WriteLine("item is null");
            }
        }
Пример #7
0
        async Task test_getAccount()
        {
            Console.WriteLine("Input key:");
            string key = Console.ReadLine();

            ThinNeo.Hash160 shash  = new ThinNeo.Hash160(Config.sc_oracle);
            var             result = await oracleSw_Com.api_InvokeScript(shash, "getAccount", "(str)" + key);

            oracleSw_Com.ResultItem item = result.value;

            if (item != null)
            {
                byte[] data = item.data;

                string value = ThinNeo.Helper.Bytes2HexString(data);

                Console.WriteLine(key + ":" + value);
            }
            else
            {
                Console.WriteLine("item is null");
            }
        }