3using System.Threading.Tasks;
51 bool TerminateStateMachine;
53 if (
string.IsNullOrEmpty(ContractId))
55 ContractId = TokenContractId;
56 TerminateStateMachine =
true;
59 TerminateStateMachine =
false;
61 KeyValuePair<Contract, IqResultEventArgs> P = await Arguments.
Legal.GetContract(ContractId);
65 if (
string.IsNullOrEmpty(P.Value?.ErrorText))
70 ": " + P.Value.ErrorText);
74 if (!TerminateStateMachine)
76 bool ReferencesTokenContract =
false;
77 string ContractReferenceId =
null;
85 ContractReferenceId = ContractReference.Value;
87 if (ContractReferenceId == TokenContractId)
89 ReferencesTokenContract =
true;
96 if (!ReferencesTokenContract)
98 throw new GenericException(
"Contract does not reference the token creation contract, so the token state machine is prohibited from failing the contract.",
99 null,
null,
null,
null,
null,
null,
null,
100 new KeyValuePair<string, object>(
"ContractId", ContractId),
101 new KeyValuePair<string, object>(
"Reason", Reason),
102 new KeyValuePair<string, object>(
"TokenContractId", TokenContractId),
103 new KeyValuePair<string, object>(
"ContractReferenceId", ContractReferenceId));
109 if (TerminateStateMachine)
118 ContractId == TokenContractId, Reason,
true, Arguments.
Legal,
123 StringBuilder sb =
new StringBuilder();
125 sb.Append(
"<failContract xmlns='");
127 sb.Append(
"' contractId='");
129 sb.Append(
"' reason='");
139 if (TerminateStateMachine)
Helps with common XML-related tasks.
static string Encode(string s)
Encodes a string for use in XML.
Generic exception, with meta-data for logging.
XmppAddress MainDomain
Main/principal domain address
bool IsComponentDomain(CaseInsensitiveString Domain, bool IncludeAlternativeDomains)
Checks if a domain is the component domain, or optionally, an alternative component domain.
XmppServer Server
XMPP Server.
Contains information about one XMPP address.
override string ToString()
object.ToString()
CaseInsensitiveString Domain
Domain
static readonly XmppAddress Empty
Empty address.
Task< bool > SendMessage(string Type, string Id, string From, string To, string Language, string ContentXml)
Sends a Message stanza to a recipient.
Contains the definition of a contract
Contract-reference parameter
Abstract base class for contractual parameters
Legal (digital identities, smart contracts) service component.
static string NamespaceSmartContracts(NamespaceSet Version)
Returns the namespace for smart contracts.
Marketplace processor, brokering sales of items via tenders and offers defined in smart contracts.
CaseInsensitiveString CreationContract
ID of contract that details the creation of the token.
Exception related to state machine.
Abstract base class for contract actions.
Fail the contract used to create the token, associated with the state-machine.
override string LocalName
Local name
Fail()
Fail the contract used to create the token, associated with the state-machine.
override async Task Execute(EvaluationArguments Arguments, string Reason, string ContractId)
Evaluates the action node
override IStateMachineNode Create()
Creates a new node of the corresponding type.
Contains information required for evaluating script in a state-machine.
StateMachine Machine
Reference to state-machine definition.
EDalerComponent EDaler
eDaler component.
LegalComponent Legal
Legal component
Profiler Profiler
State-Machine profiler.
Token Token
Reference to related token.
Class representing a state machine.
static async Task GoToState(string StateId, EvaluationArguments Arguments)
Goes to a new state.
CaseInsensitiveString DefinitionContractId
ID of Definition Contract
Service Module hosting the XMPP broker and its components.
Interface for State-Machine nodes
NamespaceSet
Namespace versions