Ejemplo n.º 1
0
        public Task <string> GetCreatorQueryAsyncTest([PexAssumeUnderTest] GenericContractService target, BlockParameter blockParameter)
        {
            Task <string> result = target.GetCreatorQueryAsync(blockParameter);

            Assert.IsNotNull(result);
            return(result);
        }
Ejemplo n.º 2
0
        public Task <string> DeclineRequestAsyncTest([PexAssumeUnderTest] GenericContractService target, DeclineFunction declineFunction)
        {
            Task <string> result = target.DeclineRequestAsync(declineFunction);

            Assert.IsNotNull(result);
            return(result);
        }
Ejemplo n.º 3
0
        public GenericContractService ConstructorTest(global::Nethereum.Web3.Web3 web3, string contractAddress)
        {
            GenericContractService target = new GenericContractService(web3, contractAddress);

            Assert.IsNotNull(target);
            return(target);
        }
Ejemplo n.º 4
0
        public Task <string> ApproveRequestAsyncTest([PexAssumeUnderTest] GenericContractService target, ApproveFunction approveFunction)
        {
            Task <string> result = target.ApproveRequestAsync(approveFunction);

            Assert.IsNotNull(result);
            return(result);
        }
Ejemplo n.º 5
0
        public Task <BigInteger> GetStatusQueryAsyncTest([PexAssumeUnderTest] GenericContractService target, BlockParameter blockParameter)
        {
            Task <BigInteger> result = target.GetStatusQueryAsync(blockParameter);

            Assert.IsNotNull(result);
            return(result);
        }
Ejemplo n.º 6
0
        public Task <string> AddAttachmentHashRequestAsyncTest([PexAssumeUnderTest] GenericContractService target, string hash)
        {
            Task <string> result = target.AddAttachmentHashRequestAsync(hash);

            Assert.IsNotNull(result);
            return(result);
        }
Ejemplo n.º 7
0
        public Task <byte[]> GetTokenQueryAsyncTest(
            [PexAssumeUnderTest] GenericContractService target,
            GetTokenFunction getTokenFunction,
            BlockParameter blockParameter
            )
        {
            Task <byte[]> result = target.GetTokenQueryAsync(getTokenFunction, blockParameter);

            Assert.IsNotNull(result);
            return(result);
        }
Ejemplo n.º 8
0
        public Task <BigInteger> GetCreateDateQueryAsyncTest(
            [PexAssumeUnderTest] GenericContractService target,
            GetCreateDateFunction getCreateDateFunction,
            BlockParameter blockParameter
            )
        {
            Task <BigInteger> result = target.GetCreateDateQueryAsync(getCreateDateFunction, blockParameter);

            Assert.IsNotNull(result);
            return(result);
        }
Ejemplo n.º 9
0
        public Task <TransactionReceipt> DeployContractAndWaitForReceiptAsyncTest(
            global::Nethereum.Web3.Web3 web3,
            GenericContractDeployment genericContractDeployment,
            CancellationTokenSource cancellationTokenSource
            )
        {
            Task <TransactionReceipt> result = GenericContractService.DeployContractAndWaitForReceiptAsync
                                                   (web3, genericContractDeployment, cancellationTokenSource);

            return(result);
        }
Ejemplo n.º 10
0
        public Task <GenericContractService> DeployContractAndGetServiceAsyncTest(
            global::Nethereum.Web3.Web3 web3,
            GenericContractDeployment genericContractDeployment,
            CancellationTokenSource cancellationTokenSource
            )
        {
            Task <GenericContractService> result = GenericContractService.DeployContractAndGetServiceAsync
                                                       (web3, genericContractDeployment, cancellationTokenSource);

            Assert.IsNotNull(result);
            return(result);
        }
Ejemplo n.º 11
0
        public Task <TransactionReceipt> ApproveRequestAndWaitForReceiptAsyncTest(
            [PexAssumeUnderTest] GenericContractService target,
            ApproveFunction approveFunction,
            CancellationTokenSource cancellationToken
            )
        {
            Task <TransactionReceipt> result
                = target.ApproveRequestAndWaitForReceiptAsync(approveFunction, cancellationToken);

            Assert.IsNotNull(result);
            return(result);
        }
Ejemplo n.º 12
0
        public Task <TransactionReceipt> AddAttachmentHashRequestAndWaitForReceiptAsyncTest(
            [PexAssumeUnderTest] GenericContractService target,
            string hash,
            CancellationTokenSource cancellationToken
            )
        {
            Task <TransactionReceipt> result
                = target.AddAttachmentHashRequestAndWaitForReceiptAsync(hash, cancellationToken);

            Assert.IsNotNull(result);
            return(result);
        }
Ejemplo n.º 13
0
        public void ApproveContract(Guid contractId, string contractAddress)
        {
            var web3 = new Web3(_account, _blockChainUrl);

            var approve = new ApproveFunction()
            {
                FromAddress = _account.Address,
                Gas         = DefaultGasAmount
            };

            var service = new GenericContractService(web3, contractAddress);

            _ = service.ApproveRequestAsync(approve);
        }
Ejemplo n.º 14
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="contractBindingModel"></param>
        /// <returns></returns>
        public async Task <ResponseModel> AddContract(ContractBindingModel contractBindingModel)
        {
            var    amountToSend = new HexBigInteger(1000000000000000000);
            string keccak       = Multihash.Encode(contractBindingModel.Token1 + contractBindingModel.Token2, HashType.KECCAK_256);

            byte[] keccak2 = Multihash.Encode(contractBindingModel.Token1 + contractBindingModel.Token2, HashType.KECCAK_256);


            var web3 = new Web3(_account, _blockChainUrl);

            var deployment = CreateGenericContract(Guid.NewGuid(), contractBindingModel);

            deployment.Gas = DefaultGasAmount;

            var transactionHash = await GenericContractService.DeployContractAsync(web3, deployment);

            //var addAttachment = await service.AddAttachmentHashRequestAndWaitForReceiptAsync(new AddAttachmentHashFunction
            //{
            //  FromAddress = _account.Address,
            //  Hash = contractBindingModel.FileChecksum,
            //  Gas = DefaultGasAmount
            //});

            var contractId = transactionHash;
            var abi        = _contractRepository.GetAbi();
            var bin        = _contractRepository.GetBin();

            var responseModel = new ResponseModel(contractBindingModel.ContextId, contractId, bin, abi);

            _ = BenChainClientApi.Client.Signator.BenChainUpdateWithHttpMessagesAsync(new SignatoryModel
            {
                BenChainABI        = abi,
                BenChainBytescode  = bin,
                BenChainContractId = contractId,
                ContextId          = contractBindingModel.ContextId
            });

            return(responseModel);
        }
Ejemplo n.º 15
0
        public Task <string> DeployContractAsyncTest(global::Nethereum.Web3.Web3 web3, GenericContractDeployment genericContractDeployment)
        {
            Task <string> result = GenericContractService.DeployContractAsync(web3, genericContractDeployment);

            return(result);
        }