You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/r3/atomic-swap/corda/evm-interop-contracts/src/main/kotlin/com/r3/corda/evminterop/DefaultEventEncoder.kt
Copy file name to clipboardExpand all lines: src/r3/atomic-swap/corda/evm-interop-contracts/src/main/kotlin/com/r3/corda/evminterop/contracts/swap/LockStateContract.kt
+8-2
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,9 @@ class LockStateContract : Contract {
37
37
tx:LedgerTransaction,
38
38
cmd:LockCommand.Unlock
39
39
) {
40
+
val inputsTxHash = tx.inputs.map { it.ref.txhash }.distinct().singleOrNull()
41
+
?:throwIllegalArgumentException("Inputs from multiple transactions is not supported")
42
+
40
43
val unlockedAssetState = tx.outputStates.filterIsInstance<OwnableState>().single()
41
44
val lockState = tx.inputStates.filterIsInstance<LockState>().single()
42
45
val txIndexKey =RlpEncoder.encode(
@@ -51,7 +54,7 @@ class LockStateContract : Contract {
51
54
"Only two input states can exist" using (tx.inputStates.size ==2)
52
55
"Invalid recipient for this command" using (unlockedAssetState.owner.owningKey == lockState.assetRecipient)
53
56
"EVM Transfer event has not been validated by the minimum number of validators" using (cmd.proof.validatorSignatures.size >= lockState.signaturesThreshold)
54
-
"The transaction receipt does not contain the expected unlock event" using (lockState.forwardEvent.isFoundIn(
57
+
"The transaction receipt does not contain the expected unlock event" using (lockState.unlockEvent.transferEvent(inputsTxHash).isFoundIn(
55
58
cmd.proof.transactionReceipt
56
59
))
57
60
"The transaction receipts merkle proof failed to validate" using (PatriciaTrie.verifyMerkleProof(
@@ -72,6 +75,9 @@ class LockStateContract : Contract {
72
75
tx:LedgerTransaction,
73
76
cmd:LockCommand.Revert
74
77
) {
78
+
val inputsTxHash = tx.inputs.map { it.ref.txhash }.distinct().singleOrNull()
79
+
?:throwIllegalArgumentException("Inputs from multiple transactions is not supported")
80
+
75
81
val unlockedAssetState = tx.outputStates.filterIsInstance<OwnableState>().single()
76
82
val lockState = tx.inputStates.filterIsInstance<LockState>().single()
77
83
val txIndexKey =RlpEncoder.encode(
@@ -85,7 +91,7 @@ class LockStateContract : Contract {
85
91
requireThat {
86
92
"Only two input states can exist" using (tx.inputStates.size ==2)
87
93
"Invalid recipient for this command" using (unlockedAssetState.owner.owningKey == lockState.assetSender)
88
-
"The transaction receipt does not contain the expected unlock event" using (lockState.backwardEvent.isFoundIn(
94
+
"The transaction receipt does not contain the expected unlock event" using (lockState.unlockEvent.revertEvent(inputsTxHash).isFoundIn(
89
95
cmd.proof.transactionReceipt
90
96
))
91
97
"The transaction receipts merkle proof failed to validate" using (PatriciaTrie.verifyMerkleProof(
Copy file name to clipboardExpand all lines: src/r3/atomic-swap/corda/evm-interop-contracts/src/main/kotlin/com/r3/corda/evminterop/states/swap/LockState.kt
Copy file name to clipboardExpand all lines: src/r3/atomic-swap/corda/evm-interop-contracts/src/main/kotlin/com/r3/corda/evminterop/states/swap/SwapTransactionDetails.kt
0 commit comments