tx · HRfy2qqbncGWR4ZCTFzHAigbFrXq41HZmo42d1UhC3B

3N61Cvq5XcnPk9rxpy2Rnp3bSr4syNGUJph:  -0.01400000 Waves

2021.10.26 16:02 [1763291] smart account 3N61Cvq5XcnPk9rxpy2Rnp3bSr4syNGUJph > SELF 0.00000000 Waves

{ "type": 13, "id": "HRfy2qqbncGWR4ZCTFzHAigbFrXq41HZmo42d1UhC3B", "fee": 1400000, "feeAssetId": null, "timestamp": 1635253409877, "version": 2, "chainId": 84, "sender": "3N61Cvq5XcnPk9rxpy2Rnp3bSr4syNGUJph", "senderPublicKey": "G7cNXePvAHUHmZfXa1eHnvFeH6DuykPC5wm9v9djTKgD", "proofs": [ "4ZAzDDGsHZWpqtnw7WqVd3bcWfcRq9dxqBfKPdWFLYAFRG35hDjvjmF3c1BJp3So9brdPXKMXSRot8RhBHGze42g" ], "script": "base64:AAIFAAAAAAAAABEIAhIAEgASAwoBCBIECgIIAQAAAAMAAAAACmRlcG9zaXRGZWUAAAAAAAAAA+gAAAAADWNvbnRyb2xsZXJGZWUAAAAAAAAAJxAAAAAAC3BsYXRmb3JtRmVlAAAAAAAAACcQAAAABAAAAAJhOAEAAAAEaW5pdAAAAAAJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAICAAAAMTNQUEg3eDdpcW9iVzV6aXlpUkNpYzE5clFxS3I2blBZYUsxX2Fzc2V0X2JhbGFuY2UAAAAAAAAAAAAJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAICAAAATjNQUEg3eDdpcW9iVzV6aXlpUkNpYzE5clFxS3I2blBZYUsxXzNNdGhzdUM1RUR5ZWhHb0t2eXp3aFp2TUVOcm9IUHNnYVhTX2Vhcm5lZAAAAAAAAAAAAAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgIAAABVM1BQSDd4N2lxb2JXNXppeWlSQ2ljMTlyUXFLcjZuUFlhSzFfM010aHN1QzVFRHllaEdvS3Z5endoWnZNRU5yb0hQc2d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WUJAARMAAAAAgkBAAAABEJ1cm4AAAACCQACWQAAAAEFAAAAEGRBcHBBc3NldEFkZHJlc3MFAAAAEGFtb3VudFdpdGhvdXRGZWUJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAABBhbW91bnRXaXRob3V0RmVlCQACWQAAAAEFAAAAFWxpcXVpZHV0eUFzc2V0QWRkcmVzcwkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgUAAAANcG9vbEFtb3VudEtleQUAAAANbmV3UG9vbEFtb3VudAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgUAAAARdXNlclBvb2xBbW91bnRLZXkFAAAAEW5ld1VzZXJQb29sQW1vdW50CQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACBQAAABF1c2VyUG9vbEVhcm5lZEtleQUAAAAPdXNlckVhcm5lZFRvdGFsBQAAAANuaWwJAAACAAAAAQIAAAAmWW91IGhhdmUgbm90IHN1Y2ggYmFsYW5jZSBmb3Igd2l0aGRyYXcAAAABAAAAAmI2AQAAAAJiNwAAAAAJAAH0AAAAAwgFAAAAAmI2AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACYjYAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACYjYAAAAPc2VuZGVyUHVibGljS2V5/DFKbA==", "height": 1763291, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9UUA9eyMTDEbaq6wx9op4mSKFyiBTD8btzHeqLqhwMTx Next: AsYm4VDUZw46TuV9SVaLbbKCUYXb2s8zPcVmwwCjYByp Diff:
OldNewDifferences
6565 case nothing =>
6666 0
6767 }
68- let dAppAssetAddress = getStringValue(this, (pool + "_liquidity_token"))
69- let liquidityTokenDecimal = match assetInfo(fromBase58String(dAppAssetAddress)) {
68+ let liquidutyAssetAddress = getStringValue(this, (pool + "_liquidity_token"))
69+ let liquidityTokenDecimal = match assetInfo(fromBase58String(liquidutyAssetAddress)) {
7070 case asset: Asset =>
7171 asset.decimals
7272 case _ =>
7373 throw("Can't find asset")
7474 }
75+ let dAppAssetAddress = getStringValue(this, (pool + "_service_token"))
7576 let userEarnedTotal = (userEarned + userEarnedBefore)
7677 let amountWithoutFee = ((amount - fraction(amount, 1, platformFee, HALFUP)) - fraction(amount, 1, controllerFee, HALFUP))
7778 let newPoolAmount = (poolAmount - amountWithoutFee)
7879 if ((userAmount >= amount))
7980 then {
8081 let newUserPoolAmount = (userAmount - amountWithoutFee)
81-[ScriptTransfer(i.caller, amountWithoutFee, fromBase58String(dAppAssetAddress)), IntegerEntry(poolAmountKey, newPoolAmount), IntegerEntry(userPoolAmountKey, newUserPoolAmount), IntegerEntry(userPoolEarnedKey, userEarnedTotal)]
82+[Burn(fromBase58String(dAppAssetAddress), amountWithoutFee), ScriptTransfer(i.caller, amountWithoutFee, fromBase58String(liquidutyAssetAddress)), IntegerEntry(poolAmountKey, newPoolAmount), IntegerEntry(userPoolAmountKey, newUserPoolAmount), IntegerEntry(userPoolEarnedKey, userEarnedTotal)]
8283 }
8384 else throw("You have not such balance for withdraw")
8485 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let depositFee = 1000
55
66 let controllerFee = 10000
77
88 let platformFee = 10000
99
1010 @Callable(a8)
1111 func init () = [IntegerEntry("3PPH7x7iqobW5ziyiRCic19rQqKr6nPYaK1_asset_balance", 0), IntegerEntry("3PPH7x7iqobW5ziyiRCic19rQqKr6nPYaK1_3MthsuC5EDyehGoKvyzwhZvMENroHPsgaXS_earned", 0), IntegerEntry("3PPH7x7iqobW5ziyiRCic19rQqKr6nPYaK1_3MthsuC5EDyehGoKvyzwhZvMENroHPsgaXS_asset_balance", 0)]
1212
1313
1414
1515 @Callable(a8)
1616 func call () = {
1717 let a9 = Issue("Asset1", "Asset from dApp", 100000, 2, true, unit, 0)
1818 let b1 = calculateAssetId(a9)
1919 [BinaryEntry("bin", base58''), BooleanEntry("bool", true), IntegerEntry("int", 1), StringEntry("str", ""), DeleteEntry("str"), a9]
2020 }
2121
2222
2323
2424 @Callable(i)
2525 func deposit (pool) = {
2626 let amount = i.payments[0].amount
2727 let assetId = i.payments[0].assetId
2828 let poolAmountKey = (pool + "_asset_balance")
2929 let userAddress = toString(i.caller)
3030 let userPoolAmountKey = (((pool + "_") + userAddress) + "_asset_balance")
3131 let dAppAssetAddress = getStringValue(this, (pool + "_service_token"))
3232 let poolAmount = getIntegerValue(this, poolAmountKey)
3333 let userAmount = match getInteger(userPoolAmountKey) {
3434 case int: Int =>
3535 int
3636 case nothing =>
3737 0
3838 }
3939 let newPoolAmount = (poolAmount + amount)
4040 let userAmountWithoutFee = ((amount - fraction(amount, 1, depositFee, DOWN)) - fraction(amount, 1, controllerFee, DOWN))
4141 let newUserPoolAmount = (userAmount + userAmountWithoutFee)
4242 [Reissue(fromBase58String(dAppAssetAddress), userAmountWithoutFee, true), ScriptTransfer(i.caller, userAmountWithoutFee, fromBase58String(dAppAssetAddress)), IntegerEntry(poolAmountKey, newPoolAmount), IntegerEntry(userPoolAmountKey, newUserPoolAmount)]
4343 }
4444
4545
4646
4747 @Callable(i)
4848 func withdraw (pool,userEarned) = {
4949 let amount = i.payments[0].amount
5050 let assetId = i.payments[0].assetId
5151 let poolAmountKey = (pool + "_asset_balance")
5252 let userAddress = toString(i.caller)
5353 let userPoolAmountKey = (((pool + "_") + userAddress) + "_asset_balance")
5454 let userPoolEarnedKey = (((pool + "_") + userAddress) + "_earned")
5555 let poolAmount = getIntegerValue(this, poolAmountKey)
5656 let userAmount = match getInteger(userPoolAmountKey) {
5757 case int: Int =>
5858 int
5959 case nothing =>
6060 0
6161 }
6262 let userEarnedBefore = match getInteger(userPoolEarnedKey) {
6363 case int: Int =>
6464 int
6565 case nothing =>
6666 0
6767 }
68- let dAppAssetAddress = getStringValue(this, (pool + "_liquidity_token"))
69- let liquidityTokenDecimal = match assetInfo(fromBase58String(dAppAssetAddress)) {
68+ let liquidutyAssetAddress = getStringValue(this, (pool + "_liquidity_token"))
69+ let liquidityTokenDecimal = match assetInfo(fromBase58String(liquidutyAssetAddress)) {
7070 case asset: Asset =>
7171 asset.decimals
7272 case _ =>
7373 throw("Can't find asset")
7474 }
75+ let dAppAssetAddress = getStringValue(this, (pool + "_service_token"))
7576 let userEarnedTotal = (userEarned + userEarnedBefore)
7677 let amountWithoutFee = ((amount - fraction(amount, 1, platformFee, HALFUP)) - fraction(amount, 1, controllerFee, HALFUP))
7778 let newPoolAmount = (poolAmount - amountWithoutFee)
7879 if ((userAmount >= amount))
7980 then {
8081 let newUserPoolAmount = (userAmount - amountWithoutFee)
81-[ScriptTransfer(i.caller, amountWithoutFee, fromBase58String(dAppAssetAddress)), IntegerEntry(poolAmountKey, newPoolAmount), IntegerEntry(userPoolAmountKey, newUserPoolAmount), IntegerEntry(userPoolEarnedKey, userEarnedTotal)]
82+[Burn(fromBase58String(dAppAssetAddress), amountWithoutFee), ScriptTransfer(i.caller, amountWithoutFee, fromBase58String(liquidutyAssetAddress)), IntegerEntry(poolAmountKey, newPoolAmount), IntegerEntry(userPoolAmountKey, newUserPoolAmount), IntegerEntry(userPoolEarnedKey, userEarnedTotal)]
8283 }
8384 else throw("You have not such balance for withdraw")
8485 }
8586
8687
8788 @Verifier(b6)
8889 func b7 () = sigVerify(b6.bodyBytes, b6.proofs[0], b6.senderPublicKey)
8990

github/deemru/w8io/026f985 
40.44 ms