Skip to content

Commit

Permalink
- Github #519 Query addresses of notaries from a contract
Browse files Browse the repository at this point in the history
  • Loading branch information
yurivin committed May 24, 2019
1 parent 91168db commit 9a2f484
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,28 @@ import javax.validation.constraints.NotNull
class EthController {
private val log = KLogging().logger

@PostMapping("/deploy/D3/masterContract/data")
fun getMasterContractData(@NotNull @RequestBody request: GetMasterContractPeersRequest): ResponseEntity<UpdateMasterContractResponse> {
try {
val deployHelper = DeployHelperBuilder(
request.network.ethereumConfig,
request.network.ethPasswords
).setFastTransactionManager()
.build()
if (request.masterContractAddress != null) {
val master = deployHelper.loadMasterContract(request.masterContractAddress)

val tokens = master.tokens.send()
val peers = master.peers(address)
}
} catch (e: Exception) {
log.error("Error adding peer to smart contract", e)
return ResponseEntity.status(HttpStatus.CONFLICT).body(
UpdateMasterContractResponse(e.javaClass.simpleName, e.message)
)
}
}

@PostMapping("/deploy/D3/masterContract/update")
fun addPeerToMasterContract(@NotNull @RequestBody request: UpdateMasterContractRequest): ResponseEntity<UpdateMasterContractResponse> {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ data class UpdateMasterContractResponse(
}
}

data class GetMasterContractPeersRequest(
@NotNull val network: EthereumNetworkProperties = EthereumNetworkProperties(),
@NotNull val masterContractAddress: String? = null
)

data class UpdateMasterContractRequest(
@NotNull val network: EthereumNetworkProperties = EthereumNetworkProperties(),
@NotNull val masterContract: MasterContractProperties = MasterContractProperties(),
Expand Down

0 comments on commit 9a2f484

Please sign in to comment.