public object Post(DeployContracts request) { // Deploy the library contract and await until the transaction has been mined TransactionHash libTransactionHash = AppServices.createSignDeployContract( AppModelConfig.LIB.abi, AppModelConfig.LIB.bytecode, request.SigningPrivateKey, null); TransactionResult libTransResult = (TransactionResult)Get(new GetReceipt { TransactionHash = libTransactionHash.Hash }); // Deploy the trust contract and await until the transaction has been mined TransactionHash trustTransactionHash = AppServices.createSignDeployContract( AppModelConfig.TRUST.abi, AppModelConfig.linkContractBytecode(AppModelConfig.TRUST.bytecode, "Lib", libTransResult.ContractAddress), request.SigningPrivateKey, null); TransactionResult trustTransResult = (TransactionResult)Get(new GetReceipt { TransactionHash = trustTransactionHash.Hash }); // Deploy the pool contract TransactionHash poolTransactionHash = AppServices.createSignDeployContract( AppModelConfig.POOL.abi, AppModelConfig.linkContractBytecode(AppModelConfig.POOL.bytecode, "Lib", libTransResult.ContractAddress), request.SigningPrivateKey, trustTransResult.ContractAddress); TransactionResult poolTransResult = (TransactionResult)Get(new GetReceipt { TransactionHash = poolTransactionHash.Hash }); // Deploy the bond contract TransactionHash bondTransactionHash = AppServices.createSignDeployContract( AppModelConfig.BOND.abi, AppModelConfig.linkContractBytecode(AppModelConfig.BOND.bytecode, "Lib", libTransResult.ContractAddress), request.SigningPrivateKey, trustTransResult.ContractAddress); TransactionResult bondTransResult = (TransactionResult)Get(new GetReceipt { TransactionHash = bondTransactionHash.Hash }); // Deploy the bank contract TransactionHash bankTransactionHash = AppServices.createSignDeployContract( AppModelConfig.BANK.abi, AppModelConfig.linkContractBytecode(AppModelConfig.BANK.bytecode, "Lib", libTransResult.ContractAddress), request.SigningPrivateKey, trustTransResult.ContractAddress); TransactionResult bankTransResult = (TransactionResult)Get(new GetReceipt { TransactionHash = bankTransactionHash.Hash }); // Deploy the policy contract TransactionHash policyTransactionHash = AppServices.createSignDeployContract( AppModelConfig.POLICY.abi, AppModelConfig.linkContractBytecode(AppModelConfig.POLICY.bytecode, "Lib", libTransResult.ContractAddress), request.SigningPrivateKey, trustTransResult.ContractAddress); TransactionResult policyTransResult = (TransactionResult)Get(new GetReceipt { TransactionHash = policyTransactionHash.Hash }); // Deploy the claim contract TransactionHash settlementTransactionHash = AppServices.createSignDeployContract( AppModelConfig.SETTLEMENT.abi, AppModelConfig.linkContractBytecode(AppModelConfig.SETTLEMENT.bytecode, "Lib", libTransResult.ContractAddress), request.SigningPrivateKey, trustTransResult.ContractAddress); TransactionResult settlementTransResult = (TransactionResult)Get(new GetReceipt { TransactionHash = settlementTransactionHash.Hash }); // Deploy the adjustor contract TransactionHash adjustorTransactionHash = AppServices.createSignDeployContract( AppModelConfig.ADJUSTOR.abi, AppModelConfig.linkContractBytecode(AppModelConfig.ADJUSTOR.bytecode, "Lib", libTransResult.ContractAddress), request.SigningPrivateKey, trustTransResult.ContractAddress); TransactionResult adjustorTransResult = (TransactionResult)Get(new GetReceipt { TransactionHash = adjustorTransactionHash.Hash }); // Deploy the timer contract TransactionHash timerTransactionHash = AppServices.createSignDeployContract( AppModelConfig.TIMER.abi, AppModelConfig.linkContractBytecode(AppModelConfig.TIMER.bytecode, "Lib", libTransResult.ContractAddress), request.SigningPrivateKey, trustTransResult.ContractAddress); TransactionResult timerTransResult = (TransactionResult)Get(new GetReceipt { TransactionHash = timerTransactionHash.Hash }); // Submit and return the transaction hash of the broadcasted transaction TransactionHash initEcosytemHash = AppServices.createSignPublishTransaction( AppModelConfig.TRUST.abi, trustTransResult.ContractAddress, request.SigningPrivateKey, "initEcosystem", poolTransResult.ContractAddress, // pool bondTransResult.ContractAddress, // bond bankTransResult.ContractAddress, // bank policyTransResult.ContractAddress, // policy settlementTransResult.ContractAddress, // settlement adjustorTransResult.ContractAddress, // adjustor timerTransResult.ContractAddress, // timer request.IsWinterTime ); // Get the transaction result TransactionResult initTransResult = (TransactionResult)Get(new GetReceipt { TransactionHash = initEcosytemHash.Hash }); // Return the addresses of the newly created contracts return(new EcosystemContractAddresses { TrustContractAdr = trustTransResult.ContractAddress, PoolContractAdr = poolTransResult.ContractAddress, BondContractAdr = bondTransResult.ContractAddress, BankContractAdr = bankTransResult.ContractAddress, PolicyContractAdr = policyTransResult.ContractAddress, SettlementContractAdr = settlementTransResult.ContractAddress, AdjustorContractAdr = adjustorTransResult.ContractAddress, TimerContractAdr = timerTransResult.ContractAddress }); }