fork download
  1. class PolicyContract : Contract {
  2.  
  3. companion object {
  4. @JvmStatic
  5. val POLICY_CONTRACT_ID = "com.example.contract.PolicyContract"
  6. }
  7.  
  8. override fun verify(tx: LedgerTransaction) {
  9. val commandCreate = tx.commands.requireSingleCommand<Commands.Create>()
  10. requireThat {
  11. "No inputs should be consumed when creating an Policy ." using (tx.inputs.isEmpty())
  12. //"Only one customer state should be created." using (tx.outputs.size == 1)
  13. val out = tx.outputsOfType<PolicyState>().single()
  14. "The insurer and the airline cannot be the same entity." using (out.insurer != out.airline)
  15. "All of the participants must be signers." using (commandCreate.signers.containsAll(out.participants.map { it.owningKey }))
  16.  
  17. // IOU-specific constraints.
  18. "The Policy holders SSN value must not be an empty String." using (out.ssn.isNotEmpty() )
  19.  
  20. "The Policy Number should not be null or empty." using (out.policyNumber.isNotEmpty() )
  21. }
  22.  
  23. }
  24.  
  25.  
  26. interface Commands : CommandData {
  27. class Create : Commands
  28.  
  29. }
  30. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.kt:1:24: error: unresolved reference: Contract
class PolicyContract : Contract {
                       ^
prog.kt:8:5: error: 'verify' overrides nothing
    override fun verify(tx: LedgerTransaction) {
    ^
prog.kt:8:29: error: unresolved reference: LedgerTransaction
    override fun verify(tx: LedgerTransaction) {
                            ^
prog.kt:10:9: error: unresolved reference: requireThat
        requireThat {
        ^
prog.kt:11:70: error: unresolved reference: using
            "No inputs should be consumed when creating an Policy ." using (tx.inputs.isEmpty())
                                                                     ^
prog.kt:13:40: error: unresolved reference: PolicyState
            val out = tx.outputsOfType<PolicyState>().single()
                                       ^
prog.kt:14:70: error: unresolved reference: using
            "The insurer and the airline cannot be the same entity." using (out.insurer != out.airline)
                                                                     ^
prog.kt:15:56: error: unresolved reference: using
            "All of the participants must be signers." using (commandCreate.signers.containsAll(out.participants.map { it.owningKey }))
                                                       ^
prog.kt:15:120: error: unresolved reference: it
            "All of the participants must be signers." using (commandCreate.signers.containsAll(out.participants.map { it.owningKey }))
                                                                                                                       ^
prog.kt:18:73: error: unresolved reference: using
            "The Policy holders SSN value must not be an empty String." using (out.ssn.isNotEmpty() )
                                                                        ^
prog.kt:20:62: error: unresolved reference: using
            "The Policy Number should not be null or empty." using (out.policyNumber.isNotEmpty() )
                                                             ^
prog.kt:26:26: error: unresolved reference: CommandData
    interface Commands : CommandData {
                         ^
stdout
Standard output is empty