コード例 #1
0
        public void ShouldDeploySmartIdentity()
        {
            using (var testrpcRunner = new TestRPCEmbeddedRunner())
            {
                try
                {
                    testrpcRunner.RedirectOuputToDebugWindow = true;
                    testrpcRunner.StartTestRPC();
                    var web3           = new Web3();
                    var addresses      = (web3.Eth.Accounts.SendRequestAsync()).Result;
                    var alice          = addresses[0];
                    var retailBank     = addresses[1];
                    var commercialBank = addresses[2];

                    var kycAttributeHash = "0xca02b2202ffaacbd499438ef6d594a48f7a7631b60405ec8f30a0d7c096dc3ff";
                    var endorsementHash  = "0xca02b2202ffaacbd499438ef6d594a48f7a7631b60405ec8f30a0d7c096d54d5";

                    //smartIdentity.GetOwnerAsync()

                    // Deploy the contract and add the multiplier to the constructor
                    var gas = web3.Eth.DeployContract.EstimateGasAsync(SmartIdentityService.ABI, SmartIdentityService.BYTE_CODE,
                                                                       alice).Result;
                    var transactionHash =
                        SmartIdentityService.DeployContractAsync(web3, alice, gas).Result;
                    Assert.IsNotNull(transactionHash);
                    var receipt = web3.Eth.Transactions.GetTransactionReceipt.SendRequestAsync(transactionHash).Result;
                    Assert.IsNotNull(receipt);
                }
                finally
                {
                    testrpcRunner.StopTestRPC();
                }
            }
        }
コード例 #2
0
        public void ShouldDeployContractForOwnerWithEnoughGasAndReturnReceipt()
        {
            gas = web3.Eth.DeployContract.EstimateGasAsync(SmartIdentityService.ABI, SmartIdentityService.BYTE_CODE,
                                                           owner).Result;
            var transactionHash =
                SmartIdentityService.DeployContractAsync(web3, owner, gas).Result;

            Assert.IsNotNull(transactionHash);
            _contract = web3.Eth.Transactions.GetTransactionReceipt.SendRequestAsync(transactionHash).Result;
            Assert.IsNotNull(_contract);
        }