{
    "version": 5,
    "timestamp": 1707359228424,
    "reference": "GKTx1DuYccRX62AKWGnD6cyUAFz8DKBr6qbySPMbiMrh",
    "nxt-consensus": {
        "base-target": 70,
        "generation-signature": "2R6EDfm6KXza9qMk1ainGb28KDQfEjrmy7DALNEmK55Z1qL3rgK2DVHAxfE4oQUvJbSjnJZjfvFEqHcqesybRFpko7piLAzxFfWdSRTe3stN83hKovmjxu7zA5rGrbn5EDqQ"
    },
    "transactionsRoot": "5Y9QRfCgwuPtVPhErkrLcAUkChXWbB1qEs7zfkvGVJvc",
    "id": "AJb2bYVpc9yMspEJyw9hQ2ecFwV6K17hRYHBdrXfngHZ",
    "features": [],
    "desiredReward": -1,
    "generator": "3MvbutkV3xapQVUcGBGWCongwfdH8LKTm8w",
    "generatorPublicKey": "9bNzvarUWDCnAv4YrNKtSh6FQXQ94jFZNkciJNcH4dgj",
    "stateHash": "ARwzjWJDKXKmAxE4pfay4uhAQxaLs2sdMxoHhNUmxJwa",
    "signature": "CHTt5kuhMoHt9jdzFKV1yxnVa7ZSdiJntc4XoHDm8Xstdc3ttJZoW7cZip631Q39ue8ToLpNJKPguA29QmPjTUL",
    "blocksize": 5296,
    "transactionCount": 3,
    "totalFee": 1500000,
    "reward": 600000000,
    "rewardShares": {
        "3MvbutkV3xapQVUcGBGWCongwfdH8LKTm8w": 200000000,
        "3Myb6G8DkdBb8YcZzhrky65HrmiNuac3kvS": 200000000,
        "3N13KQpdY3UU7JkWUBD9kN7t7xuUgeyYMTT": 200000000
    },
    "VRF": "3JVCHhtsThEbChtWEvB5CnzKJvgpkupC5Y8nbMsHm3Gs",
    "fee": 1500000,
    "previous": "2966672",
    "height": "2966673",
    "next": "2966674",
    "transactions": [
        {
            "type": 16,
            "id": "BXtVCS9MvfkKNcmBgJodeQA71fpNCHcwc4z4kCAFJoZY",
            "fee": 500000,
            "feeAssetId": null,
            "timestamp": 1707359233606,
            "version": 2,
            "chainId": 84,
            "sender": "3N1zCcy5aEojvD5xNCjuxphHtwycQXr42TP",
            "senderPublicKey": "8Zv7itBufxgv2KeiMV5hoSn63XJraBp48dK3R8tuB5nE",
            "proofs": [
                "2WNWEDRyE72Gh5uzVTWCmMc6iHnekyK9S69aw96ainqNDbUkMWbu8yGX2BG112pPrwWFwAA5JfCaJRnAsRdqdHtZ"
            ],
            "dApp": "3N9tKixzqTYWnEXQxrDQ5pBTGvQd6sFsvmV",
            "payment": [
                {
                    "amount": 10000000,
                    "assetId": "AxGKQRxKo4F2EbhrRq6N2tdLsxtMnpzQsS4QemV6V1W1"
                }
            ],
            "call": {
                "function": "registerTask",
                "args": [
                    {
                        "type": "string",
                        "value": "Design a smart contract in the WAVES Ride language that allows token holders to stake a minimum of 100 tokens in a Liquidity Pool. The staked tokens should earn a 10% weekly reward from the total amount staked. The smart contract should include functions for staking tokens, checking rewards, and withdrawing funds. Ensure that the contract enforces the minimum stake requirement and calculates the rewards accurately based on the total amount staked. Generate the smart contract code that implements this staking mechanism."
                    },
                    {
                        "type": "string",
                        "value": "chatgpt"
                    }
                ]
            },
            "applicationStatus": "succeeded"
        },
        {
            "type": 16,
            "id": "F6esYjsLGVzbWJGnhrBe8RuQCyR8NBBFYe3h8gzdXuCn",
            "fee": 500000,
            "feeAssetId": null,
            "timestamp": 1707359241894,
            "version": 2,
            "chainId": 84,
            "sender": "3N9ttyLcRwDo7L4EmJkbS3ZFuQJygivupsL",
            "senderPublicKey": "92ovWCy1Zf8CSsTLLLssC74m8yn5yPMqVp9fmVacou97",
            "proofs": [
                "4GxFUUsATHUcKbsE4cBguccG6qPa5FySCLWpGnfnH5AiyseYMpHKsvAavreti6UpDZasqsRVs23KnKqDGVYYPyBd"
            ],
            "dApp": "3N9tKixzqTYWnEXQxrDQ5pBTGvQd6sFsvmV",
            "payment": [],
            "call": {
                "function": "checkoutTask",
                "args": [
                    {
                        "type": "string",
                        "value": "BXtVCS9MvfkKNcmBgJodeQA71fpNCHcwc4z4kCAFJoZY_8Zv7itBufxgv2KeiMV5hoSn63XJraBp48dK3R8tuB5nE"
                    },
                    {
                        "type": "string",
                        "value": "chatgpt"
                    }
                ]
            },
            "applicationStatus": "succeeded"
        },
        {
            "type": 16,
            "id": "7yrCjeFjVFussvGwTeRoor7kTwc3DW5XpiWWAud32gte",
            "fee": 500000,
            "feeAssetId": null,
            "timestamp": 1707359262399,
            "version": 2,
            "chainId": 84,
            "sender": "3N9ttyLcRwDo7L4EmJkbS3ZFuQJygivupsL",
            "senderPublicKey": "92ovWCy1Zf8CSsTLLLssC74m8yn5yPMqVp9fmVacou97",
            "proofs": [
                "3w4wpBKW99HgrwyxnVuoPcUPoJQs3R4ZwDYTTrgCDjA8ETeFWtYR2AR67Jvv3LwAJBf5MDUovDAFvn4ZN8vpDo9C"
            ],
            "dApp": "3N9tKixzqTYWnEXQxrDQ5pBTGvQd6sFsvmV",
            "payment": [],
            "call": {
                "function": "commitTask",
                "args": [
                    {
                        "type": "string",
                        "value": "BXtVCS9MvfkKNcmBgJodeQA71fpNCHcwc4z4kCAFJoZY_8Zv7itBufxgv2KeiMV5hoSn63XJraBp48dK3R8tuB5nE"
                    },
                    {
                        "type": "string",
                        "value": "Certainly! Here is an example of a smart contract in the WAVES Ride language that implements the described staking mechanism:\n\n```ride\nlet token = base58'BvTQMF8sXbqZ9ytfekcKarzVqpZYEckpfVUqTjoe6pmt' // Replace with your token ID\n\n@Callable(i)\nfunc stakeTokens(amount: Int) = {\n    let currentStake = if let existingStake = getInteger(i.caller.bytes) then existingStake else 0\n    if amount >= 100 {\n        let newStake = currentStake + amount\n        if (amount > 0) then {\n            let updatedBalances = [BinaryEntry(i.caller.bytes, newStake)]\n            WriteSet(updatedBalances)\n            \n            let totalStake = if let existingTotalStake = getInteger(this.issuer.bytes) then existingTotalStake else 0\n            let newTotalStake = totalStake + amount\n            let updatedTotalBalance = [BinaryEntry(this.issuer.bytes, newTotalStake)]\n            WriteSet(updatedTotalBalance)\n            \n            let result = "Successfully staked " + amount.toString() + " tokens."\n            TransferSet([{assetId: token, amount: amount, recipient: this.issuer}])\n            ScriptResult(s, result)\n        } else {\n            let result = "Please stake a positive amount of tokens."\n            ScriptResult(ERROR, result)\n        }\n    } else {\n        let result = "Minimum stake requirement is 100 tokens."\n        ScriptResult(ERROR, result)\n    }\n}\n\n@Callable(i)\nfunc checkRewards() = {\n    let totalStake = if let existingTotalStake = getInteger(this.issuer.bytes) then existingTotalStake else 0\n    let userStake = if let existingUserStake = getInteger(i.caller.bytes) then existingUserStake else 0\n    \n    let rewards = (totalStake * 10) / 100\n    let userRewards = (userStake * rewards) / totalStake\n    \n    let result = "Your rewards: " + userRewards.toString() + " tokens."\n    ScriptResult(s, result)\n}\n\n@Callable(i)\nfunc withdrawFunds() = {\n    let userStake = if let existingUserStake = getInteger(i.caller.bytes) then existingUserStake else 0\n    \n    if (userStake > 0) then {\n        let totalStake = if let existingTotalStake = getInteger(this.issuer.bytes) then existingTotalStake else 0\n        let rewards = (totalStake * 10) / 100\n        let userRewards = (userStake * rewards) / totalStake\n        \n        let updatedBalances = [BinaryEntry(i.caller.bytes, 0)]\n        WriteSet(updatedBalances)\n        \n        let newTotalStake = totalStake - userStake\n        let updatedTotalBalance = [BinaryEntry(this.issuer.bytes, newTotalStake)]\n        WriteSet(updatedTotalBalance)\n        \n        let result = "Successfully withdrawn " + userStake.toString() + " tokens and " + userRewards.toString() + " rewards."\n        TransferSet([{assetId: token, amount: userStake + userRewards, recipient: i.caller}])\n        ScriptResult(s, result)\n    } else {\n        let result = "No tokens to withdraw."\n        ScriptResult(ERROR, result)\n    }\n}\n```\n\nPlease note that you need to replace the `token` variable with the actual ID of the token you want to use for staking. Also, ensure that you have issued the token on the Waves blockchain before deploying this smart contract.\n\nThis smart contract includes three functions: `stakeTokens`, `checkRewards`, and `withdrawFunds`. The `stakeTokens` function allows a user to stake the specified amount of tokens, as long as the minimum requirement of 100 tokens is met. The `checkRewards` function calculates the rewards earned by the user based on their stake and the total stake in the pool. The `withdrawFunds` function allows a user to withdraw their staked tokens and earned rewards.\n\nFeel free to modify the code as needed to fit your specific requirements and token."
                    }
                ]
            },
            "applicationStatus": "succeeded"
        }
    ]
}

github/deemru/w8io/3ef1775 
9.70 ms