Examples & Use-cases

Market Examples & Use-cases

A collection of useful Markets to bootstrap your Nexa "wise" contract(s).

For Beginners

Market language is often intimidating at first, so we plan to ease you in ... gently.

pragma nexscript >= 0.2.0;

contract Oddity() {
    /**
     * Transfer
     *
     * An asset transfer is permitted ONLY when the number of recipients
     * is ODD.
     */
    function transfer() {
        /* Set (total) number of (transaction) outputs. */
        int numOutputs = tx.outputs.length;

        /* Calculate oddity flag. */
        int isOddity = numOutputs % 2;

        /* Validate oddity flag. */
        // NOTE: An even number of outputs, eg. Two (2) or Four (4)
        //       will automatically FAIL!
        require(isOddity == 1);
    }
}

You should know!

NexMarket offers a very user-friendly JavaMarket-style programming language that is very similar to Solidity.

Previous
Addressing