tx · 79UmBhn3LHMrm3EUnCAnG4GHVN674EEKeNDvx7R56wAZ

3N4bt53eU7kwBbhAkh2KFYajCc1kAtu9TY8:  -0.01400000 Waves

2022.02.21 18:29 [1933598] smart account 3N4bt53eU7kwBbhAkh2KFYajCc1kAtu9TY8 > SELF 0.00000000 Waves

{ "type": 13, "id": "79UmBhn3LHMrm3EUnCAnG4GHVN674EEKeNDvx7R56wAZ", "fee": 1400000, "feeAssetId": null, "timestamp": 1645457404272, "version": 2, "chainId": 84, "sender": "3N4bt53eU7kwBbhAkh2KFYajCc1kAtu9TY8", "senderPublicKey": "6so6qVTu5xitJ3xkhqQ3AiC1noyJFbQF84JTjfW1uZTr", "proofs": [ "61fx56cJ9vhV1whErujBTyzb8VHpzRnQNjoj7tysQ8pKz7rRLQz7eKWmdxQxE7QHDnaWwLrEvzpnzpCLPREdJeFg" ], "script": "base64:AAIFAAAAAAAAAB4IAhIHCgUICAgEARIDCgEIEgUKAwgEARIFCgMIBAEAAAAJAAAAAAdmb3VuZGVyCQEAAAAHQWRkcmVzcwAAAAEBAAAAGgFU48Tc28jbioeqqpgFSKGY6wdEuVchU7umAAAAABFDb21taXNzaW9uUGVyY2VudAAAAAAAAAAABQAAAAAIU3RhdHVzTmECAAAADU5PVF9BVkFJTEFCTEUAAAAADlN0YXR1c1RyYWRhYmxlAgAAAAhUUkFEQUJMRQAAAAARU3RhdHVzTm90VHJhZGFibGUCAAAADE5PVF9UUkFEQUJMRQEAAAAQZ2V0VG9rZW5Pd25lcktleQAAAAEAAAAFdG9rZW4JAAEsAAAAAgIAAAAMdG9rZW5fb3duZXJfCQACWAAAAAEFAAAABXRva2VuAQAAABFnZXRUb2tlblN0YXR1c0tleQAAAAEAAAAFdG9rZW4JAAEsAAAAAgIAAAANdG9rZW5fc3RhdHVzXwkAAlgAAAABBQAAAAV0b2tlbgEAAAAQZ2V0VG9rZW5QcmljZUtleQAAAAEAAAAFdG9rZW4JAAEsAAAAAgIAAAAMdG9rZW5fcHJp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jcmlwdFRyYW5zZmVyAAAAAwUAAAAHZm91bmRlcgUAAAAOcmVhbENvbW1pc3Npb24FAAAABHVuaXQJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkBAAAAEGdldFRva2VuT3duZXJLZXkAAAABBQAAAAdhc3NldElkBQAAABNjYWxsZXJBZGRyZXNzU3RyaW5nCQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAIJAQAAABFnZXRUb2tlblN0YXR1c0tleQAAAAEFAAAAB2Fzc2V0SWQJAQAAAAxib29sVG9TdGF0dXMAAAABBQAAAAppc1RyYWRhYmxlCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACCQEAAAAQZ2V0VG9rZW5QcmljZUtleQAAAAEFAAAAB2Fzc2V0SWQFAAAACG5ld1ByaWNlBQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleXUVVxQ=", "height": 1933598, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: E86wfZdkYvG9E1CkZMygdRWetv9QA4EGakWJ8DNapD6j Next: HH7i8rSCfVRxS1EukEiTAzFgHjYnwwq43TegwfjHRJKH Diff:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let founder = Address(base58'3MuRN7peEs8ezRsgKGN7PmWzChkEkEp19ru')
4+let founder = Address(base58'3NAgQzjC1xnhXV6cEp38eJ2vjYAjBUaaLQm')
55
66 let CommissionPercent = 5
77
3131 else {
3232 let asset = Issue(name, description, 1, 0, false)
3333 let assetId = calculateAssetId(asset)
34-[ScriptTransfer(i.caller, 1, assetId), StringEntry(getTokenOwnerKey(assetId), ownerAddress), StringEntry(getTokenStatusKey(assetId), boolToStatus(isTradable)), IntegerEntry(getTokenPriceKey(assetId), price)]
34+[StringEntry(getTokenOwnerKey(assetId), ownerAddress), StringEntry(getTokenStatusKey(assetId), boolToStatus(isTradable)), IntegerEntry(getTokenPriceKey(assetId), price), asset]
3535 }
3636
3737
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let founder = Address(base58'3MuRN7peEs8ezRsgKGN7PmWzChkEkEp19ru')
4+let founder = Address(base58'3NAgQzjC1xnhXV6cEp38eJ2vjYAjBUaaLQm')
55
66 let CommissionPercent = 5
77
88 let StatusNa = "NOT_AVAILABLE"
99
1010 let StatusTradable = "TRADABLE"
1111
1212 let StatusNotTradable = "NOT_TRADABLE"
1313
1414 func getTokenOwnerKey (token) = ("token_owner_" + toBase58String(token))
1515
1616
1717 func getTokenStatusKey (token) = ("token_status_" + toBase58String(token))
1818
1919
2020 func getTokenPriceKey (token) = ("token_price_" + toBase58String(token))
2121
2222
2323 func boolToStatus (value) = if ((value == true))
2424 then StatusTradable
2525 else StatusNotTradable
2626
2727
2828 @Callable(i)
2929 func mint (ownerAddress,name,description,isTradable,price) = if ((founder != i.caller))
3030 then throw("Method only for founder")
3131 else {
3232 let asset = Issue(name, description, 1, 0, false)
3333 let assetId = calculateAssetId(asset)
34-[ScriptTransfer(i.caller, 1, assetId), StringEntry(getTokenOwnerKey(assetId), ownerAddress), StringEntry(getTokenStatusKey(assetId), boolToStatus(isTradable)), IntegerEntry(getTokenPriceKey(assetId), price)]
34+[StringEntry(getTokenOwnerKey(assetId), ownerAddress), StringEntry(getTokenStatusKey(assetId), boolToStatus(isTradable)), IntegerEntry(getTokenPriceKey(assetId), price), asset]
3535 }
3636
3737
3838
3939 @Callable(i)
4040 func pickUp (assetIdString) = {
4141 let assetId = fromBase58String(assetIdString)
4242 let ownerKey = getTokenOwnerKey(assetId)
4343 let statusKey = getTokenStatusKey(assetId)
4444 let realOwner = Address(fromBase58String(getStringValue(ownerKey)))
4545 let status = getStringValue(statusKey)
4646 if (if ((founder == i.caller))
4747 then true
4848 else if ((realOwner == i.caller))
4949 then (status != StatusNa)
5050 else false)
5151 then [ScriptTransfer(i.caller, 1, assetId), StringEntry(getTokenOwnerKey(assetId), ""), StringEntry(getTokenStatusKey(assetId), StatusNa), IntegerEntry(getTokenPriceKey(assetId), 0)]
5252 else throw("Only owner and founder can pick it up")
5353 }
5454
5555
5656
5757 @Callable(i)
5858 func setTokenInfo (assetIdString,isTradable,price) = {
5959 let assetId = fromBase58String(assetIdString)
6060 let ownerKey = getTokenOwnerKey(assetId)
6161 let statusKey = getTokenStatusKey(assetId)
6262 let realOwner = Address(fromBase58String(getStringValue(ownerKey)))
6363 let status = getStringValue(statusKey)
6464 if (if ((realOwner == i.caller))
6565 then (status != StatusNa)
6666 else false)
6767 then [ScriptTransfer(i.caller, 1, assetId), StringEntry(getTokenStatusKey(assetId), boolToStatus(isTradable)), IntegerEntry(getTokenPriceKey(assetId), price)]
6868 else throw("Only owner can set token trade info")
6969 }
7070
7171
7272
7373 @Callable(i)
7474 func buy (assetIdString,isTradable,newPrice) = {
7575 let assetId = i.caller.bytes
7676 let callerAddressString = toBase58String(i.caller.bytes)
7777 let callerAddress = Address(i.caller.bytes)
7878 let ownerKey = getTokenOwnerKey(assetId)
7979 let realOwner = Address(fromBase58String(getStringValue(ownerKey)))
8080 if (if ((size(i.payments) == 0))
8181 then true
8282 else (i.caller == realOwner))
8383 then throw("Payment must be attached and you should not be the asset owner")
8484 else {
8585 let pmt = i.payments[0]
8686 if (isDefined(pmt.assetId))
8787 then throw("This function accepts WAVES tokens only")
8888 else {
8989 let currentPrice = getIntegerValue(getTokenPriceKey(assetId))
9090 let onePercent = (currentPrice / 100)
9191 let totalSum = (onePercent * (100 + CommissionPercent))
9292 let realCommission = (totalSum - currentPrice)
9393 if ((pmt.amount != totalSum))
9494 then throw("Incorrect buy sum")
9595 else [ScriptTransfer(realOwner, currentPrice, unit), ScriptTransfer(founder, realCommission, unit), StringEntry(getTokenOwnerKey(assetId), callerAddressString), StringEntry(getTokenStatusKey(assetId), boolToStatus(isTradable)), IntegerEntry(getTokenPriceKey(assetId), newPrice)]
9696 }
9797 }
9898 }
9999
100100
101101 @Verifier(tx)
102102 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
103103

github/deemru/w8io/026f985 
33.70 ms