fork download
  1. class ClaimContract : Contract{
  2. companion object {
  3. @JvmStatic
  4. val CLAIM_CREATION_CONTRACT_ID = "com.example.contract.ClaimContract"
  5. }
  6.  
  7. override fun verify(tx: LedgerTransaction) {
  8. val commandCreate = tx.commands.requireSingleCommand<ClaimContract.Commands.Create>()
  9. requireThat {
  10. val inputs= tx.inputsOfType<PolicyState>().single()
  11. val outputs = tx.outputsOfType<ClaimState>().single()
  12.  
  13.  
  14.  
  15.  
  16.  
  17. "One input state should be there for claim" using (tx.inputStates.size==1)
  18. "One output states should be there for Claim" using (tx.outputStates.size==1)
  19. "Input State should be a PolicyState" using (tx.getInput(0) is PolicyState)
  20. "Output State should be a ClaimState" using((tx.getOutput(0) is ClaimState) && outputs is ClaimState)
  21.  
  22. "Policy Number should not be empty" using(inputs.policyNumber.isNotEmpty())
  23. }
  24. }
  25.  
  26. interface Commands : CommandData {
  27. class Create : Commands
  28. }
  29.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.kt:28:6: error: missing '}
    }
     ^
prog.kt:1:23: error: unresolved reference: Contract
class ClaimContract : Contract{
                      ^
prog.kt:7:5: error: 'verify' overrides nothing
    override fun verify(tx: LedgerTransaction) {
    ^
prog.kt:7:29: error: unresolved reference: LedgerTransaction
    override fun verify(tx: LedgerTransaction) {
                            ^
prog.kt:9:9: error: unresolved reference: requireThat
        requireThat {
        ^
prog.kt:10:41: error: unresolved reference: PolicyState
            val inputs= tx.inputsOfType<PolicyState>().single()
                                        ^
prog.kt:11:44: error: unresolved reference: ClaimState
            val outputs = tx.outputsOfType<ClaimState>().single()
                                           ^
prog.kt:17:57: error: unresolved reference: using
            "One input state should be there for claim" using (tx.inputStates.size==1)
                                                        ^
prog.kt:18:59: error: unresolved reference: using
            "One output states should be there for Claim" using (tx.outputStates.size==1)
                                                          ^
prog.kt:19:51: error: unresolved reference: using
            "Input State should be a PolicyState" using (tx.getInput(0) is PolicyState)
                                                  ^
prog.kt:19:76: error: unresolved reference: PolicyState
            "Input State should be a PolicyState" using (tx.getInput(0) is PolicyState)
                                                                           ^
prog.kt:20:51: error: unresolved reference: using
            "Output State should be a ClaimState" using((tx.getOutput(0) is ClaimState) && outputs is ClaimState)
                                                  ^
prog.kt:20:77: error: unresolved reference: ClaimState
            "Output State should be a ClaimState" using((tx.getOutput(0) is ClaimState) && outputs is ClaimState)
                                                                            ^
prog.kt:20:103: error: unresolved reference: ClaimState
            "Output State should be a ClaimState" using((tx.getOutput(0) is ClaimState) && outputs is ClaimState)
                                                                                                      ^
prog.kt:22:49: error: unresolved reference: using
            "Policy Number should not be empty" using(inputs.policyNumber.isNotEmpty())
                                                ^
prog.kt:26:26: error: unresolved reference: CommandData
    interface Commands : CommandData {
                         ^
stdout
Standard output is empty