diff --git a/erc20_moc/CasinoTrade.noblock.js b/erc20_moc/CasinoTrade.noblock.js index 7c5db89..a699cb0 100644 --- a/erc20_moc/CasinoTrade.noblock.js +++ b/erc20_moc/CasinoTrade.noblock.js @@ -144,7 +144,7 @@ class CasinoTrade { } }; - cashout = async (userWalletAddr, crashFactor, gameHash) => { + cashout = async (userWalletAddr, crashFactor, gameHash, cashoutLimit) => { const dbClient = await createDBTransaction(); try { @@ -156,12 +156,16 @@ class CasinoTrade { let totalReward = 0n; let stakedAmount = 0n; + let limit = BigInt(bigDecimal.round(cashoutLimit)) for (let row of res.rows) { let { stakedamount } = row; let reward = bigDecimal.multiply(BigInt(stakedamount), parseFloat(crashFactor)); reward = BigInt(bigDecimal.round(reward)); totalReward += reward; + if(totalReward > limit){ + totalReward = limit + } stakedAmount += BigInt(stakedamount); } diff --git a/package-lock.json b/package-lock.json index 5cc1393..e7737c5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@wallfair.io/smart_contract_mock", - "version": "0.11.4", + "version": "0.12.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@wallfair.io/smart_contract_mock", - "version": "0.11.4", + "version": "0.12.0", "license": "AGPL-3.0-only", "dependencies": { "@wallfair.io/wallfair-commons": "^1.8.2", diff --git a/package.json b/package.json index 92ea121..039c509 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@wallfair.io/smart_contract_mock", "author": "Wallfair", - "version": "0.11.4", + "version": "0.12.0", "description": "Wallfair Smart Contract Contract Mock in JS.", "license": "AGPL-3.0-only", "repository": {