Я пытаюсь создать свой собственный расчетный рельс с помощью Corda-отстойника, но столкнулся с проблемой, и я пытался решить ее на прошлой неделе, но я не знаю, что пошло не так. Я не уверен, что этот вопрос такой же, как и тот, который поднял TAC911 здесь .
Это команда, которую я запускаю на оболочке start UpdateSettlementMethod linearId: 389b634d-2d4f-4f00-84e9-c903b0454e4d, settlementMethod: { accountToPay: dummyAccount001, settlementOracle: Oracle, _type: com.r3.corda.finance.dummy.types.DummySettlement }
, и это ошибки:
Tue Jun 11 13:39:28 SGT 2019>>> start UpdateSettlementMethod linearId: 389b634d-2d4f-4f00-84e9-c903b0454e4d, settlementMethod: { accountToPay: dummyAccount001, settlementOracle: Oracle, _type: com.r3.corda.finance.dummy.types.DummySettlement }
No matching constructor found:
- [net.corda.core.contracts.UniqueIdentifier, com.r3.corda.finance.obligation.types.SettlementMethod]: Could not parse as a command: Could not resolve type id 'com.r3.corda.finance.dummy.types.DummySettlement' as a subtype of [simple type, class com.r3.corda.finance.obligation.types.SettlementMethod]: no such class found
at [Source: UNKNOWN; line: -1, column: -1]
Ниже приведены классы, которые я создал в моём модуле расчета:
DummyPayment:
package com.r3.corda.finance.dummy.types
import com.r3.corda.finance.obligation.types.Money
import com.r3.corda.finance.obligation.types.Payment
import com.r3.corda.finance.obligation.types.PaymentReference
import com.r3.corda.finance.obligation.types.PaymentStatus
import net.corda.core.contracts.Amount
data class DummyPayment<T : Money>(
override val paymentReference: PaymentReference,
override val amount: Amount<T>,
override var status: PaymentStatus = PaymentStatus.SENT
) : Payment<T> {
override fun toString(): String {
return "Amount: $amount, Dummy Reference: $paymentReference, Status: $status"
}
}
DummySettlement:
package com.r3.corda.finance.dummy.types
import com.r3.corda.finance.obligation.types.OffLedgerPayment
import com.r3.corda.finance.dummy.flows.MakeDummyPayment
import net.corda.core.identity.Party
data class DummySettlement(
override val accountToPay: String,
override val settlementOracle: Party,
override val paymentFlow: Class<MakeDummyPayment<*>> = MakeDummyPayment::class.java
) : OffLedgerPayment<MakeDummyPayment<*>> {
override fun toString(): String {
return "Pay to $accountToPay and use $settlementOracle as settlement Oracle."
}
}
MakeDummyPayment:
package com.r3.corda.finance.dummy.flows
import co.paralleluniverse.fibers.Suspendable
import com.r3.corda.finance.dummy.types.DummyPayment
import com.r3.corda.finance.dummy.types.DummySettlement
import com.r3.corda.finance.obligation.client.flows.MakeOffLedgerPayment
import com.r3.corda.finance.obligation.states.Obligation
import com.r3.corda.finance.obligation.types.*
import net.corda.core.contracts.Amount
import net.corda.core.contracts.StateAndRef
import net.corda.core.flows.FlowException
import net.corda.core.utilities.ProgressTracker
import com.r3.corda.finance.dummy.types.*
class MakeDummyPayment<T : Money>(
amount: Amount<T>,
obligationStateAndRef: StateAndRef<Obligation<*>>,
settlementMethod: OffLedgerPayment<*>,
progressTracker: ProgressTracker
) : MakeOffLedgerPayment<T>(amount, obligationStateAndRef, settlementMethod, progressTracker) {
@Suspendable
override fun setup() {
}
override fun checkBalance(requiredAmount: Amount<*>) {
}
@Suspendable
override fun makePayment(obligation: Obligation<*>, amount: Amount<T>): DummyPayment<T> {
if (amount.token !is FiatCurrency)
throw FlowException("Please only pay in FiatCurrency for now.")
if (obligation.settlementMethod == null)
throw FlowException("Please update the SettlementMethod to DummySettlement for now.")
if (obligation.settlementMethod !is DummySettlement)
throw FlowException("Please use only DummySettlement for now.")
return DummyPayment((obligation.payments.size + 1).toString(), amount as Amount<FiatCurrency>, PaymentStatus.SENT) as DummyPayment<T>
}
}
Команда может быть запущена, если она устанавливается в XRP. Я не уверен, существует ли какое-либо отношение к типу accountToPay (тип String в классе DummySettlement), которое может повлиять на некоторые другие зависимости?
Любая помощь или идеи будут высоко оценены.