tx · B6DXvYGgchaGZba71Hnk4BbYteXe2SD8pduXMomVqvvV

3MvhbvSm4f3m7BHS2YsKVPPpRZCB5qBPWrB:  -0.01000000 Waves

2021.11.01 15:27 [1771932] smart account 3MvhbvSm4f3m7BHS2YsKVPPpRZCB5qBPWrB > SELF 0.00000000 Waves

{ "type": 13, "id": "B6DXvYGgchaGZba71Hnk4BbYteXe2SD8pduXMomVqvvV", "fee": 1000000, "feeAssetId": null, "timestamp": 1635769674804, "version": 1, "sender": "3MvhbvSm4f3m7BHS2YsKVPPpRZCB5qBPWrB", "senderPublicKey": "8apL73EWyKeioNcFF9zCGNMBVmtx2muqJZEF34QDGEU7", "proofs": [ "28JP1zpxGN9kG7q4PF4EaZK3tHvM2iiy7nNoTGFwQqRgorhpUNKisHkaqqZSGTiv9hkYtQ2V4CpVuuWYcmdF9GbK" ], "script": "base64:AAIFAAAAAAAAABAIAhIFCgMBAQgSABIDCgECAAAADAAAAAAJc2VwYXJhdG9yAgAAAAJfXwEAAAAPZ2V0U3RyaW5nT3JGYWlsAAAAAgAAAAdhZGRyZXNzAAAAA2tleQkBAAAAE3ZhbHVlT3JFcnJvck1lc3NhZ2UAAAACCQAEHQAAAAIFAAAAB2FkZHJlc3MFAAAAA2tleQkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAAAptYW5kYXRvcnkgCQAEJQAAAAEFAAAAB2FkZHJlc3MCAAAAAS4FAAAAA2tleQIAAAAPIGlzIG5vdCBkZWZpbmVkAAAAAAhrZXlTdGFydAkABLkAAAACCQAETAAAAAICAAAAAiVzCQAETAAAAAICAAAABXN0YXJ0BQAAAANuaWwFAAAACXNlcGFyYXRvcgAAAAALa2V5RHVyYXRpb24JAAS5AAAAAgkABEwAAAACAgAAAAIlcwkABEwAAAACAgAAAAhkdXJhdGlvbgUAAAADbmlsBQAAAAlzZXBhcmF0b3IAAAAACGtleUFzc2V0CQAEuQAAAAIJAARMAAAAAgIAAAACJXMJAARMAAAAAgIAAAA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dldFVzZXJSZXdhcmRzAAAAAQkBAAAAB0FkZHJlc3MAAAABBQAAAAxhZGRyZXNzQnl0ZXMEAAAABXRvdGFsCAUAAAALJHQwMzA1NTMxMjcAAAACXzEEAAAAB2NsYWltZWQIBQAAAAskdDAzMDU1MzEyNwAAAAJfMgQAAAAJYXZhaWxhYmxlCAUAAAALJHQwMzA1NTMxMjcAAAACXzMJAAUUAAAAAgUAAAADbmlsCQAEuQAAAAIJAARMAAAAAgIAAAAGJWQlZCVkCQAETAAAAAIJAAGkAAAAAQUAAAAFdG90YWwJAARMAAAAAgkAAaQAAAABBQAAAAdjbGFpbWVkCQAETAAAAAIJAAGkAAAAAQUAAAAJYXZhaWxhYmxlBQAAAANuaWwFAAAACXNlcGFyYXRvcgkAAAIAAAABAgAAACRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4AAAAAxzcm7g==", "chainId": 84, "height": 1771932, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CutsjVuimjekvJ7npM7QPqHSJjHB95NwNxDJ7zNohXtn Next: G8sQzgYWyEutXuA2UYuJG7gWdHwHN7YBTpZf5k4F35GS Diff:
OldNewDifferences
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let separator = "__"
5+
6+func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), (((("mandatory " + toString(address)) + ".") + key) + " is not defined"))
7+
58
69 let keyStart = makeString(["%s", "start"], separator)
710
4346
4447
4548 @Callable(i)
46-func constructor (start,duration) = {
49+func constructor (start,duration,assetId) = {
4750 let targetPaymentsSize = 1
4851 let checks = [if ((i.caller == this))
4952 then true
50- else throw("Access denied"), if ((size(i.payments) == targetPaymentsSize))
51- then true
52- else throw("Exactly 1 payment must be attached")]
53+ else throw("Access denied")]
5354 if ((checks == checks))
54- then {
55- let assetId = valueOrErrorMessage(value(i.payments[0]).assetId, "WAVES can't be used")
56-[IntegerEntry(keyStart, start), IntegerEntry(keyDuration, duration), BinaryEntry(keyAsset, assetId), BooleanEntry(keyIsDataReady, false)]
57- }
55+ then [IntegerEntry(keyStart, start), IntegerEntry(keyDuration, duration), StringEntry(keyAsset, assetId), BooleanEntry(keyIsDataReady, false)]
5856 else throw("Strict value is not equal to itself.")
5957 }
6058
6260
6361 @Callable(i)
6462 func claim () = {
65- let $t023492408 = getUserRewards(i.caller)
66- let total = $t023492408._1
67- let claimed = $t023492408._2
68- let available = $t023492408._3
69- let asset = valueOrErrorMessage(getBinary(this, keyAsset), "Asset is not specified")
63+ let $t023312390 = getUserRewards(i.caller)
64+ let total = $t023312390._1
65+ let claimed = $t023312390._2
66+ let available = $t023312390._3
67+ let asset = fromBase58String(getStringOrFail(this, keyAsset))
7068 let balance = assetBalance(this, asset)
7169 let checks = [checkIfDataIsReady(), if ((available > 0))
7270 then true
8583 let checks = [checkIfDataIsReady()]
8684 if ((checks == checks))
8785 then {
88- let $t030943166 = getUserRewards(Address(addressBytes))
89- let total = $t030943166._1
90- let claimed = $t030943166._2
91- let available = $t030943166._3
86+ let $t030553127 = getUserRewards(Address(addressBytes))
87+ let total = $t030553127._1
88+ let claimed = $t030553127._2
89+ let available = $t030553127._3
9290 $Tuple2(nil, makeString(["%d%d%d", toString(total), toString(claimed), toString(available)], separator))
9391 }
9492 else throw("Strict value is not equal to itself.")
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let separator = "__"
5+
6+func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), (((("mandatory " + toString(address)) + ".") + key) + " is not defined"))
7+
58
69 let keyStart = makeString(["%s", "start"], separator)
710
811 let keyDuration = makeString(["%s", "duration"], separator)
912
1013 let keyAsset = makeString(["%s", "asset"], separator)
1114
1215 let keyIsDataReady = makeString(["%s", "isDataReady"], separator)
1316
1417 func keyUserRewardTotal (address) = makeString(["%s%s", "userRewardTotal", toString(address)], separator)
1518
1619
1720 func keyUserRewardClaimed (address) = makeString(["%s%s", "userRewardClaimed", toString(address)], separator)
1821
1922
2023 func keyClaimHistoryRecord (address,txId) = makeString(["%s%s%s", "claimHistoryRecord", toString(address), toBase58String(txId)], separator)
2124
2225
2326 func formatHistoryRecord (amount) = makeString(["%d%d%d", toString(height), toString(lastBlock.timestamp), toString(amount)], separator)
2427
2528
2629 func checkIfDataIsReady () = {
2730 let isDataReady = valueOrElse(getBoolean(this, keyIsDataReady), false)
2831 if (isDataReady)
2932 then true
3033 else throw("Data is not ready")
3134 }
3235
3336
3437 func getUserRewards (address) = {
3538 let start = valueOrErrorMessage(getInteger(this, keyStart), "Start block is not specified")
3639 let duration = valueOrErrorMessage(getInteger(this, keyDuration), "Duration is not specified")
3740 let total = valueOrElse(getInteger(this, keyUserRewardTotal(address)), 0)
3841 let claimed = valueOrElse(getInteger(this, keyUserRewardClaimed(address)), 0)
3942 let availableTotal = fraction(total, min([duration, max([0, (height - start)])]), duration)
4043 let available = max([0, (availableTotal - claimed)])
4144 $Tuple3(total, claimed, available)
4245 }
4346
4447
4548 @Callable(i)
46-func constructor (start,duration) = {
49+func constructor (start,duration,assetId) = {
4750 let targetPaymentsSize = 1
4851 let checks = [if ((i.caller == this))
4952 then true
50- else throw("Access denied"), if ((size(i.payments) == targetPaymentsSize))
51- then true
52- else throw("Exactly 1 payment must be attached")]
53+ else throw("Access denied")]
5354 if ((checks == checks))
54- then {
55- let assetId = valueOrErrorMessage(value(i.payments[0]).assetId, "WAVES can't be used")
56-[IntegerEntry(keyStart, start), IntegerEntry(keyDuration, duration), BinaryEntry(keyAsset, assetId), BooleanEntry(keyIsDataReady, false)]
57- }
55+ then [IntegerEntry(keyStart, start), IntegerEntry(keyDuration, duration), StringEntry(keyAsset, assetId), BooleanEntry(keyIsDataReady, false)]
5856 else throw("Strict value is not equal to itself.")
5957 }
6058
6159
6260
6361 @Callable(i)
6462 func claim () = {
65- let $t023492408 = getUserRewards(i.caller)
66- let total = $t023492408._1
67- let claimed = $t023492408._2
68- let available = $t023492408._3
69- let asset = valueOrErrorMessage(getBinary(this, keyAsset), "Asset is not specified")
63+ let $t023312390 = getUserRewards(i.caller)
64+ let total = $t023312390._1
65+ let claimed = $t023312390._2
66+ let available = $t023312390._3
67+ let asset = fromBase58String(getStringOrFail(this, keyAsset))
7068 let balance = assetBalance(this, asset)
7169 let checks = [checkIfDataIsReady(), if ((available > 0))
7270 then true
7371 else throw("No reward available"), if ((balance >= available))
7472 then true
7573 else throw("Insufficient funds. Contact support")]
7674 if ((checks == checks))
7775 then [ScriptTransfer(i.caller, available, asset), IntegerEntry(keyUserRewardClaimed(i.caller), (claimed + available)), StringEntry(keyClaimHistoryRecord(i.caller, i.transactionId), formatHistoryRecord(available))]
7876 else throw("Strict value is not equal to itself.")
7977 }
8078
8179
8280
8381 @Callable(i)
8482 func getUserRewardsREADONLY (addressBytes) = {
8583 let checks = [checkIfDataIsReady()]
8684 if ((checks == checks))
8785 then {
88- let $t030943166 = getUserRewards(Address(addressBytes))
89- let total = $t030943166._1
90- let claimed = $t030943166._2
91- let available = $t030943166._3
86+ let $t030553127 = getUserRewards(Address(addressBytes))
87+ let total = $t030553127._1
88+ let claimed = $t030553127._2
89+ let available = $t030553127._3
9290 $Tuple2(nil, makeString(["%d%d%d", toString(total), toString(claimed), toString(available)], separator))
9391 }
9492 else throw("Strict value is not equal to itself.")
9593 }
9694
9795

github/deemru/w8io/026f985 
43.89 ms