!RWtMGSvYZpTkkJWUTY:matrix.org

Nexa-dev

544 Members
Public discussion with the developers of Nexa5 Servers

Load older messages


SenderMessageTime
19 Aug 2023
@_discord_941426898137919579:t2bot.iomika_34_#0 changed their display name from Mf34flux to mika_34_#0.13:49:01
21 Aug 2023
@bsz:matrix.org@bsz:matrix.org left the room.12:12:40
25 Aug 2023
@_discord_804375166934319104:t2bot.iolog1053#0 changed their display name from M || log1-053 ⛛#2978 to log1053#0.09:25:50
@_discord_408140787092684801:t2bot.iomatt_k79#0 changed their display name from mjk79 to matt_k79#0.16:41:28
@_discord_408140787092684801:t2bot.iomatt_k79#0 changed their profile picture.16:41:31
28 Aug 2023
@_discord_909521627396595754:t2bot.ioy_n_s#0 changed their display name from YunusA. to y_n_s#0.18:06:05
@_discord_909521627396595754:t2bot.ioy_n_s#0 changed their profile picture.18:06:07
1 Sep 2023
@_discord_1054143996047409203:t2bot.iodreadpiratejerome#0 changed their display name from DreadPirateJerome to dreadpiratejerome#0.20:56:06
2 Sep 2023
@_discord_292365190123749386:t2bot.iopepsykolya#0 changed their display name from pepsykolya to pepsykolya#0.18:43:47
6 Sep 2023
@_discord_1067508119791484948:t2bot.ioetomazzo#0 changed their display name from E-ToMaZZo to etomazzo#0.11:43:14
11 Sep 2023
@_discord_141104301849313280:t2bot.ioporkeypine#0 changed their display name from Porkey to porkeypine#0.22:30:43
13 Sep 2023
@_discord_893536922633396254:t2bot.iob_s_z#0 changed their display name from B_S_Z#4449 to b_s_z#0.16:37:10
18 Sep 2023
@_discord_334028299917590528:t2bot.iophynncastro#0 changed their display name from PhynnCastro#1223 to phynncastro#0.13:13:39
21 Sep 2023
@_discord_494311914914971659:t2bot.ioviraldecay#0 changed their display name from ViralDecay#7746 to viraldecay#0.01:05:27
@_discord_494311914914971659:t2bot.ioviraldecay#0 changed their profile picture.01:05:29
@_discord_509034806856646656:t2bot.ioh1o5#0 changed their display name from clustan#0 to h1o5#0.08:45:19
@_discord_509034806856646656:t2bot.ioh1o5#0 changed their profile picture.08:45:22
25 Sep 2023
@_discord_861346702483914773:t2bot.iomarengoeight#0 changed their display name from MARENGO EIGHT to marengoeight#0.05:38:05
27 Sep 2023
@_discord_662660211911426080:t2bot.io.nostalgia_#0 changed their profile picture.16:40:04
28 Sep 2023
@_discord_123318660012965890:t2bot.iosayerp#0 changed their display name from Sayerp to sayerp#0.00:29:54
@_discord_1001859777716027543:t2bot.iobitpiratex#0 changed their display name from sirakka#0 to bitpiratex#0.18:19:26
@_discord_1001859777716027543:t2bot.iobitpiratex#0 changed their profile picture.18:19:27
@_discord_941426898137919579:t2bot.iomika_34_#0 changed their profile picture.19:54:22
3 Oct 2023
@jqrgen:matrix.orgjQrgen ▽ (bit/coin)Is anyone testing NexScript?21:15:57
4 Oct 2023
@nyusternie:matrix.orgShomari
pragma nexscript >= 0.2.0;

contract TradingPost(
    bytes32 tokenid,
    bytes20 seller,
    int rate,
    bytes20 provider,
    int fee,
) {
    /**
     * Cancel (Trade) Posting
     *
     * Sends all remaining assets back to the contract's owner (ie. the Seller).
     *
     * NOTE: For compliance purposes, both the Seller and the Provider have the
     *       ability to cancel a trade posting.
     *
     *       ASSETS CAN ONLY BE SENT TO THE SELLER.
     *
     * @param executor
     * @param signature
     */
    function cancelPosting(pubkey executor, sig signature) {
        /* Verify executor has provided a valid signature. */
        require(checkSig(signature, executor));

        /* Hash the executor's public key hash. */
        bytes20 pubKeyHash = hash160(executor);

        /* Verify the executor is an authorized contract participant. */
        require(pubKeyHash == seller || pubKeyHash == provider);

        /* Validate the 1st output is the Seller's `scriptPubKey`. */
        int lockingBytecodeLen = tx.outputs[0].lockingBytecode.length;
        bytes20 sellerBytecode = bytes20(tx.outputs[0].lockingBytecode.split(lockingBytecodeLen - 20)[1]);
        require(seller == sellerBytecode);

        /* Validate the 1st output is the Seller's asset. */
        require(tx.outputs[0].tokenGroupId == tokenid);

        /* Set (min/max) constants. */
        int MIN_OUTPUTS = 1;
        int MAX_OUTPUTS = 2;

        /* Validate the 2nd (change) output IS NOT the Seller's asset. */
        require(
            (tx.outputs.length == MIN_OUTPUTS) ||
            (tx.outputs.length == MAX_OUTPUTS && tx.outputs[1].tokenGroupId == 0x0)
        );
    }

    /**
     * Trade (Token) Asset
     *
     * Sends the buyer the requested amount of an asset for a rate set
     * by the contract's owner (ie. the Seller).
     */
    function tradeAsset() {
        /* Parse and verify Seller's bytecode receives the $NEXA payout. */
        int lockingBytecodeLen = tx.outputs[0].lockingBytecode.length;
        bytes20 payoutBytecode = bytes20(tx.outputs[0].lockingBytecode.split(lockingBytecodeLen - 20)[1]);
        require(payoutBytecode == seller);

        /* Set amount of $NEXA Seller paid to posting. */
        int sellerPayout = tx.outputs[0].value;

        /* Calculate and verify Buyer's asset payout amount. */
        int buyerPayout = sellerPayout / rate;
        require(tx.outputs[1].tokenAmount >= buyerPayout);

        /* Verify 2nd output is the Buyer's asset. */
        require(tx.outputs[1].tokenGroupId == tokenid);

        /* Calculate Provider commission amount (received). */
        int commission = (sellerPayout * fee) / 100;

        /* Validate and handle commission payout. */
        if (commission > 0) {
            /* Create Provider bytecode. */
            bytes23 providerBytecode = new LockingBytecodeP2PKT(provider);
            require(tx.outputs[2].lockingBytecode == providerBytecode);

            /* Verify Provider payout amount. */
            require(tx.outputs[2].value >= commission);
        }
    }
}

👆️ working on a semi-DEX contract now (does a one-way asset trade)

02:49:24
@jqrg:matrix.orgjqrg joined the room.03:30:52
@_discord_387161482292625409:t2bot.iojqrgen_#0 changed their display name from ▽ jQrgen ▽#5000 to jqrgen_#0.19:01:58
11 Oct 2023
@_discord_479338122874716172:t2bot.ioWise Degentraschizo Sensei 🧙 changed their display name from decentralizd#0 to Wise Degentraschizo Sensei 🧙.05:34:22
@_discord_334028299917590528:t2bot.iophynncastro#0 changed their profile picture.21:15:51
13 Oct 2023
@_discord_221161106008178688:t2bot.ioDolaned - nexa.pool137.io changed their display name from dolaned#0 to Dolaned - nexa.pool137.io.11:59:30

Show newer messages


Back to Room ListRoom Version: 9