示例#1
0
        public async Task QueryTest()
        {
            SimpleOutputs.UInt256 output = await ContractUtils.QueryContract <ERC20.Queries.BalanceOf, SimpleOutputs.UInt256>(
                new ERC20.Queries.BalanceOf {
                Owner = "0x0000000000000000000000000000000000000000"
            },
                "0x6810e776880C02933D47DB1b9fc05908e5386b96",
                null).ConfigureAwait(false);

            decimal result = SolidityUtils.ConvertFromUInt(output.Value, 18);

            Assert.IsTrue(result > 0);
        }
    /// <summary>
    /// Gets the gas limit which would be used to lock the curent purpose balance.
    /// </summary>
    /// <param name="prpsBalance"> The output received from the BalanceOf function of the PRPS contract. </param>
    private void GetLockableGasLimit(SimpleOutputs.UInt256 prpsBalance)
    {
        PRPSBalance = SolidityUtils.ConvertFromUInt(prpsBalance.Value, 18);

        if (prpsBalance.Value <= 0)
        {
            return;
        }

        object[] funcParams = new object[] { estimationId, prpsBalance.Value, estimationMonths };
        GasUtils.EstimateContractGasLimit <Hodler.Messages.Hodl>(hodlerContract.ContractAddress,
                                                                 userWalletManager.GetWalletAddress(),
                                                                 funcParams).OnSuccess(limit => GasLimit = limit);

        OnAmountsUpdated?.Invoke();
    }