コード例 #1
0
        public SendCreateContractResult SendCreateContractTransaction(Base58Address from, byte[] contractCode, double amount,
                                                                      object[] parameters = null, ulong gasLimit = 50000, ulong gasPrice = SmartContractMempoolValidator.MinGasPrice,
                                                                      double feeAmount    = 0.01)
        {
            if (parameters == null)
            {
                parameters = new object[0];
            }

            string[] stringParameters = parameters.Select(this.GetSerializedStringForObject).ToArray();
            BuildCreateContractTransactionResponse response = this.FirstNode.SendCreateContractTransaction(contractCode, amount, stringParameters, gasLimit, gasPrice, feeAmount, from);

            if (response.Success)
            {
                WaitForMempoolCountOnAllNodes(1);
            }

            return(new SendCreateContractResult
            {
                Fee = response.Fee,
                Hex = response.Hex,
                Message = response.Message,
                NewContractAddress = new Base58Address(response.NewContractAddress),
                Success = response.Success,
                TransactionId = response.TransactionId
            });
        }
コード例 #2
0
        public ulong GetBalanceInStratoshis(Base58Address address)
        {
            // In case it's a contract address
            ulong contractBalance = this.FirstNode.GetContractBalance(address);

            if (contractBalance > 0)
            {
                return(contractBalance);
            }

            return(this.FirstNode.GetWalletAddressBalance(address));
        }
コード例 #3
0
        public ILocalExecutionResult CallContractMethodLocally(Base58Address from, string methodName, Base58Address contractAddress,
                                                               double amount, object[] parameters = null, ulong gasLimit = 50000,
                                                               ulong gasPrice = SmartContractMempoolValidator.MinGasPrice, double feeAmount = 0.01)
        {
            if (parameters == null)
            {
                parameters = new object[0];
            }

            string[] stringParameters = parameters.Select(this.GetSerializedStringForObject).ToArray();
            return(this.FirstNode.CallContractMethodLocally(methodName, contractAddress, amount, stringParameters, gasLimit, gasPrice, from));
        }
コード例 #4
0
 public byte[] GetCode(Base58Address contractAddress)
 {
     return(this.FirstNode.GetCode(contractAddress.Value));
 }