Package com.jelurida.ardor.contracts
Class RandomPayment
java.lang.Object
nxt.addons.AbstractContract
com.jelurida.ardor.contracts.RandomPayment
- All Implemented Interfaces:
Contract
Sample contract which receives amount from the trigger transaction and returns a random amount between 0 and twice the received amount.
Warning:
This design is inappropriate for gambling applications. The reason is that users can trigger this contract using a phased
transaction and later not approve the trigger and response transactions in case they do not like the results.
For a better approach to gambling application see the AllForOnePayment sample contract.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprocessTransaction(TransactionContext context) Process a payment transaction and send back random amount to the senderMethods inherited from class nxt.addons.AbstractContract
isDuplicate, processBlock, processInvocation, processRequest, processVoucherMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface nxt.addons.Contract
init, minProductVersion, shutdown
-
Constructor Details
-
RandomPayment
public RandomPayment()
-
-
Method Details
-
processTransaction
Process a payment transaction and send back random amount to the sender- Specified by:
processTransactionin interfaceContract- Overrides:
processTransactionin classAbstractContract- Parameters:
context- contract context
-