tx · 4DaoepFAZWSLdQLF8tXn5fNxCDqeeQA4pdcqTA8fQqcY

3N61Cvq5XcnPk9rxpy2Rnp3bSr4syNGUJph:  -0.01400000 Waves

2021.10.26 14:00 [1763174] smart account 3N61Cvq5XcnPk9rxpy2Rnp3bSr4syNGUJph > SELF 0.00000000 Waves

{ "type": 13, "id": "4DaoepFAZWSLdQLF8tXn5fNxCDqeeQA4pdcqTA8fQqcY", "fee": 1400000, "feeAssetId": null, "timestamp": 1635246072351, "version": 2, "chainId": 84, "sender": "3N61Cvq5XcnPk9rxpy2Rnp3bSr4syNGUJph", "senderPublicKey": "G7cNXePvAHUHmZfXa1eHnvFeH6DuykPC5wm9v9djTKgD", "proofs": [ "2RokwVWsmgYfkrKKxto14Exdk6FsGdKpTzBzR8MLdWcXyiFHJ2s8gGEA6Pf2tTcmoUkgbKZsjLKTNYs3Qxyy34Jt" ], "script": "base64:AAIFAAAAAAAAABEIAhIAEgASAwoBCBIECgIIAQAAAAUAAAAACXVzZXJBc3NldAIAAAAsR3JmZ3BjemNjcm41QWJydUxjdFh3Qzk0MWRnd2lwQnk2SFpZRGFRWEhidWsAAAAACWRBcHBBc3NldAIAAAAsN2FwU0p4TG54REt1bmI3YUJHYXVnNXFmVFg4OGpwYzNSMjI0OXBidUpVMngAAAAACmRlcG9zaXRGZWUAAAAAAAAAA+gAAAAADWNvbnRyb2xsZXJGZWUAAAAAAAAAJxAAAAAAC3BsYXRmb3JtRmVlAAAAAAAAACcQAAAABAAAAAJhOAEAAAAEaW5pdAAAAAAJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAICAAAAMTNQUEg3eDdpcW9iVzV6aXlpUkNpYzE5clFxS3I2blBZYUsxX2Fzc2V0X2JhbGFuY2UAAAAAAAAAAAAJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAICAAAATjNQUEg3eDdpcW9iVzV6aXlpUkNpYzE5clFxS3I2blBZYUsxXzNNdGhzdUM1RUR5ZWhHb0t2eXp3aF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HJ5AAAAAgUAAAANcG9vbEFtb3VudEtleQUAAAANbmV3UG9vbEFtb3VudAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgUAAAARdXNlclBvb2xBbW91bnRLZXkFAAAAEW5ld1VzZXJQb29sQW1vdW50CQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACBQAAABF1c2VyUG9vbEVhcm5lZEtleQUAAAAPdXNlckVhcm5lZFRvdGFsBQAAAANuaWwJAAACAAAAAQIAAAAmWW91IGhhdmUgbm90IHN1Y2ggYmFsYW5jZSBmb3Igd2l0aGRyYXcAAAABAAAAAmI2AQAAAAJiNwAAAAAJAAH0AAAAAwgFAAAAAmI2AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACYjYAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACYjYAAAAPc2VuZGVyUHVibGljS2V51Bw/IQ==", "height": 1763174, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: G4Pba6KgZPq8F8e5RvJKtQDLUvVrrgHwqiwaYiV893vS Next: 98FMcrJd5dRW71fToMq2bpdEB7VLUWXTsrPP2sQsb3CC Diff:
OldNewDifferences
7676 throw("Can't find asset")
7777 }
7878 let userEarnedTotal = (userEarned + userEarnedBefore)
79- let amountWithoutFee = ((amount - fraction(amount, 1, platformFee, DOWN)) - fraction(amount, 1, controllerFee, DOWN))
79+ let amountWithoutFee = ((amount - fraction(amount, 1, platformFee, HALFUP)) - fraction(amount, 1, controllerFee, HALFUP))
8080 let newPoolAmount = (poolAmount - amountWithoutFee)
8181 if ((userAmount >= amount))
8282 then {
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let userAsset = "Grfgpczccrn5AbruLctXwC941dgwipBy6HZYDaQXHbuk"
55
66 let dAppAsset = "7apSJxLnxDKunb7aBGaug5qfTX88jpc3R2249pbuJU2x"
77
88 let depositFee = 1000
99
1010 let controllerFee = 10000
1111
1212 let platformFee = 10000
1313
1414 @Callable(a8)
1515 func init () = [IntegerEntry("3PPH7x7iqobW5ziyiRCic19rQqKr6nPYaK1_asset_balance", 0), IntegerEntry("3PPH7x7iqobW5ziyiRCic19rQqKr6nPYaK1_3MthsuC5EDyehGoKvyzwhZvMENroHPsgaXS_earned", 0), IntegerEntry("3PPH7x7iqobW5ziyiRCic19rQqKr6nPYaK1_3MthsuC5EDyehGoKvyzwhZvMENroHPsgaXS_asset_balance", 0)]
1616
1717
1818
1919 @Callable(a8)
2020 func call () = {
2121 let a9 = Issue("Asset1", "Asset from dApp", 100000, 2, true, unit, 0)
2222 let b1 = calculateAssetId(a9)
2323 [BinaryEntry("bin", base58''), BooleanEntry("bool", true), IntegerEntry("int", 1), StringEntry("str", ""), DeleteEntry("str"), a9]
2424 }
2525
2626
2727
2828 @Callable(i)
2929 func deposit (pool) = {
3030 let amount = i.payments[0].amount
3131 let assetId = i.payments[0].assetId
3232 let poolAmountKey = (pool + "_asset_balance")
3333 let userAddress = toString(i.caller)
3434 let userPoolAmountKey = (((pool + "_") + userAddress) + "_asset_balance")
3535 let dAppAssetAddress = getStringValue(this, (pool + "_service_token"))
3636 let poolAmount = getIntegerValue(this, poolAmountKey)
3737 let userAmount = match getInteger(userPoolAmountKey) {
3838 case int: Int =>
3939 int
4040 case nothing =>
4141 0
4242 }
4343 let newPoolAmount = (poolAmount + amount)
4444 let newUserPoolAmount = (userAmount + ((amount - fraction(amount, 1, depositFee, DOWN)) - fraction(amount, 1, controllerFee, DOWN)))
4545 [ScriptTransfer(i.caller, amount, fromBase58String(dAppAssetAddress)), IntegerEntry(poolAmountKey, newPoolAmount), IntegerEntry(userPoolAmountKey, newUserPoolAmount)]
4646 }
4747
4848
4949
5050 @Callable(i)
5151 func withdraw (pool,userEarned) = {
5252 let amount = i.payments[0].amount
5353 let assetId = i.payments[0].assetId
5454 let poolAmountKey = (pool + "_asset_balance")
5555 let userAddress = toString(i.caller)
5656 let userPoolAmountKey = (((pool + "_") + userAddress) + "_asset_balance")
5757 let userPoolEarnedKey = (((pool + "_") + userAddress) + "_earned")
5858 let poolAmount = getIntegerValue(this, poolAmountKey)
5959 let userAmount = match getInteger(userPoolAmountKey) {
6060 case int: Int =>
6161 int
6262 case nothing =>
6363 0
6464 }
6565 let userEarnedBefore = match getInteger(userPoolEarnedKey) {
6666 case int: Int =>
6767 int
6868 case nothing =>
6969 0
7070 }
7171 let dAppAssetAddress = getStringValue(this, (pool + "_liquidity_token"))
7272 let liquidityTokenDecimal = match assetInfo(fromBase58String(dAppAssetAddress)) {
7373 case asset: Asset =>
7474 asset.decimals
7575 case _ =>
7676 throw("Can't find asset")
7777 }
7878 let userEarnedTotal = (userEarned + userEarnedBefore)
79- let amountWithoutFee = ((amount - fraction(amount, 1, platformFee, DOWN)) - fraction(amount, 1, controllerFee, DOWN))
79+ let amountWithoutFee = ((amount - fraction(amount, 1, platformFee, HALFUP)) - fraction(amount, 1, controllerFee, HALFUP))
8080 let newPoolAmount = (poolAmount - amountWithoutFee)
8181 if ((userAmount >= amount))
8282 then {
8383 let newUserPoolAmount = (userAmount - amountWithoutFee)
8484 [ScriptTransfer(i.caller, amountWithoutFee, fromBase58String(dAppAssetAddress)), IntegerEntry(poolAmountKey, newPoolAmount), IntegerEntry(userPoolAmountKey, newUserPoolAmount), IntegerEntry(userPoolEarnedKey, userEarnedTotal)]
8585 }
8686 else throw("You have not such balance for withdraw")
8787 }
8888
8989
9090 @Verifier(b6)
9191 func b7 () = sigVerify(b6.bodyBytes, b6.proofs[0], b6.senderPublicKey)
9292

github/deemru/w8io/026f985 
35.46 ms