tx · 8K418caAMrRd84nhmSZv8UCULSV4qQ9XkwT3hC5XyZ29

3N6DGohy3A1oqkBk6F4BRPHrqgkVgwxWd8g:  -0.01000000 Waves

2021.09.09 15:27 [1695517] smart account 3N6DGohy3A1oqkBk6F4BRPHrqgkVgwxWd8g > SELF 0.00000000 Waves

{ "type": 13, "id": "8K418caAMrRd84nhmSZv8UCULSV4qQ9XkwT3hC5XyZ29", "fee": 1000000, "feeAssetId": null, "timestamp": 1631190462330, "version": 1, "sender": "3N6DGohy3A1oqkBk6F4BRPHrqgkVgwxWd8g", "senderPublicKey": "AkPpYa8oqgaNXjTSuWGaMCnJ6y44pYUMeskeBjzVgPhr", "proofs": [ "43RCFEKFgDjkMTCUU39HgcKVdqedNUisJ2ZCVCe5ErHsd3D5zU5vzbi3g9NY2Yy6vyajooiibA9qFixSxAnnDr7x" ], "script": "base64:AAIFAAAAAAAAABIIAhIDCgEIEgMKAQgSBAoCCAgAAAAGAAAAAANTRVACAAAAAl9fAQAAAA9nZXRTdHJpbmdPckZhaWwAAAABAAAAA2tleQkBAAAAE3ZhbHVlT3JFcnJvck1lc3NhZ2UAAAACCQAEIgAAAAEFAAAAA2tleQkAASwAAAACCQABLAAAAAICAAAAD21hbmRhdG9yeSB0aGlzLgUAAAADa2V5AgAAAA8gaXMgbm90IGRlZmluZWQBAAAAGGdldFN0cmluZ0J5QWRkcmVzc09yRmFpbAAAAAIAAAAHYWRkcmVzcwAAAANrZXkJAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAgkABB0AAAACBQAAAAdhZGRyZXNzBQAAAANrZXkJAAEsAAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAKbWFuZGF0b3J5IAkABCUAAAABBQAAAAdhZGRyZXNzAgAAAAEuBQAAAANrZXkCAAAADyBpcyBub3QgZGVmaW5lZAEAAAARa2V5RmFjdG9yeUFkZHJlc3MAAAAAAgAAABwlcyVzX19jb25maWdfX2ZhY3RvcnlBZGRyZXNzAQ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AwMDAwMDAwMDAwCQAETAAAAAICAAAACjEwMDAwMDAwMDAJAARMAAAAAgIAAAAJMTAwMDAwMDAwBQAAAANuaWwFAAAAA1NFUAAAAADHalU1", "chainId": 84, "height": 1695517, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DsybKmn7gN7ChAZACcDSM9cBTYFWN7XWWYPqiB7EgEM Next: 2WQtyHdb3t42PgDjS3Fbr5H69a67eFqjByxGXdgg42cx Diff:
OldNewDifferences
1818 func readFactoryAddressOrFail () = addressFromStringValue(getStringOrFail(keyFactoryAddress()))
1919
2020
21-func keyStakedByUser (userAddressStr,lpAssetIdStr) = makeString(["%s%s%s__staked", userAddressStr, lpAssetIdStr], SEP)
22-
23-
24-func keyStakedTotal (lpAssetIdStr) = ("%s%s%s__staked__total__" + lpAssetIdStr)
25-
26-
27-func readStaked (key) = valueOrElse(getInteger(this, key), 0)
28-
29-
30-func keyOperationHistoryRecord (type,userAddress,txId58) = makeString(["%s%s%s%s__history", type, userAddress, txId58], SEP)
31-
32-
33-func formatHistoryRecord (userAddress,lpAssetId,type,amount) = makeString(["%s%s%s%d%d%d", userAddress, lpAssetId, type, toString(height), toString(lastBlock.timestamp), toString(amount)], SEP)
34-
35-
36-func OperationHistoryEntry (type,userAddress,lpAssetId,amount,txId) = StringEntry(keyOperationHistoryRecord(type, userAddress, toBase58String(txId)), formatHistoryRecord(userAddress, lpAssetId, type, amount))
37-
38-
3921 @Callable(i)
40-func constructor (factoryAddressStr) = if ((i.caller != this))
22+func constructor (factoryAddress) = if ((i.caller != this))
4123 then throw("not authorized")
42- else [StringEntry(keyFactoryAddress(), factoryAddressStr)]
24+ else [StringEntry(keyFactoryAddress(), factoryAddress)]
4325
4426
4527
4628 @Callable(i)
47-func stake () = {
48- let factory = readFactoryAddressOrFail()
49- if ((size(i.payments) != 1))
50- then throw("invalid payment - exact one payment must be attached")
51- else {
52- let pmt = i.payments[0]
53- let lpAssetId = value(pmt.assetId)
54- let lpAssetIdStr = toBase58String(lpAssetId)
55- let userAddressStr = toString(i.caller)
56- let amount = pmt.amount
57- if (!(isDefined(getString(factory, keyFactoryLp2AssetsMapping(lpAssetIdStr)))))
58- then throw(("unsupported lp asset " + lpAssetIdStr))
59- else {
60- let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr)
61- let stakedTotalKEY = keyStakedByUser(userAddressStr, lpAssetIdStr)
62- let stakedByUser = readStaked(stakedByUserKEY)
63- let stakedTotal = readStaked(stakedTotalKEY)
64-[IntegerEntry(stakedByUserKEY, (stakedByUser + amount)), IntegerEntry(stakedTotalKEY, (stakedTotal + amount)), OperationHistoryEntry("stake", userAddressStr, lpAssetIdStr, amount, i.transactionId)]
65- }
66- }
67- }
29+func currentRewardRateREADONLY (lpAssetId) = $Tuple2(nil, makeString(["%d%d%d", "320000000", "1100000000", "100000000000"], SEP))
6830
6931
7032
7133 @Callable(i)
72-func unstake (lpAssetIdStr,amount) = {
73- let factory = readFactoryAddressOrFail()
74- let userAddressStr = toString(i.caller)
75- let lpAssetId = fromBase58String(lpAssetIdStr)
76- if (!(isDefined(getString(factory, keyFactoryLp2AssetsMapping(lpAssetIdStr)))))
77- then throw(("unsupported lp asset " + lpAssetIdStr))
78- else {
79- let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr)
80- let stakedTotalKEY = keyStakedByUser(userAddressStr, lpAssetIdStr)
81- let stakedByUser = readStaked(stakedByUserKEY)
82- let stakedTotal = readStaked(stakedTotalKEY)
83- if ((amount > stakedByUser))
84- then throw("passed amount is less then available")
85- else [IntegerEntry(stakedByUserKEY, (stakedByUser - amount)), IntegerEntry(stakedTotalKEY, (stakedTotal - amount)), ScriptTransfer(i.caller, amount, lpAssetId), OperationHistoryEntry("unstake", userAddressStr, lpAssetIdStr, amount, i.transactionId)]
86- }
87- }
88-
89-
90-
91-@Callable(i)
92-func claimWx (lpAssetIdStr) = throw("temorary disabled")
93-
94-
95-
96-@Callable(i)
97-func claimWxREADONLY (lpAssetIdStr,userAddress) = $Tuple2(nil, makeString(["%s%s%d", lpAssetIdStr, userAddress, "10000500000"], SEP))
34+func currentUserRewardRateREADONLY (lpAssetId,userAddress) = $Tuple2(nil, makeString(["%d%d%d", "320000000", "1100000000", "100000000000", "1000000000", "100000000"], SEP))
9835
9936
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SEP = "__"
55
66 func getStringOrFail (key) = valueOrErrorMessage(getString(key), (("mandatory this." + key) + " is not defined"))
77
88
99 func getStringByAddressOrFail (address,key) = valueOrErrorMessage(getString(address, key), (((("mandatory " + toString(address)) + ".") + key) + " is not defined"))
1010
1111
1212 func keyFactoryAddress () = "%s%s__config__factoryAddress"
1313
1414
1515 func keyFactoryLp2AssetsMapping (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP)
1616
1717
1818 func readFactoryAddressOrFail () = addressFromStringValue(getStringOrFail(keyFactoryAddress()))
1919
2020
21-func keyStakedByUser (userAddressStr,lpAssetIdStr) = makeString(["%s%s%s__staked", userAddressStr, lpAssetIdStr], SEP)
22-
23-
24-func keyStakedTotal (lpAssetIdStr) = ("%s%s%s__staked__total__" + lpAssetIdStr)
25-
26-
27-func readStaked (key) = valueOrElse(getInteger(this, key), 0)
28-
29-
30-func keyOperationHistoryRecord (type,userAddress,txId58) = makeString(["%s%s%s%s__history", type, userAddress, txId58], SEP)
31-
32-
33-func formatHistoryRecord (userAddress,lpAssetId,type,amount) = makeString(["%s%s%s%d%d%d", userAddress, lpAssetId, type, toString(height), toString(lastBlock.timestamp), toString(amount)], SEP)
34-
35-
36-func OperationHistoryEntry (type,userAddress,lpAssetId,amount,txId) = StringEntry(keyOperationHistoryRecord(type, userAddress, toBase58String(txId)), formatHistoryRecord(userAddress, lpAssetId, type, amount))
37-
38-
3921 @Callable(i)
40-func constructor (factoryAddressStr) = if ((i.caller != this))
22+func constructor (factoryAddress) = if ((i.caller != this))
4123 then throw("not authorized")
42- else [StringEntry(keyFactoryAddress(), factoryAddressStr)]
24+ else [StringEntry(keyFactoryAddress(), factoryAddress)]
4325
4426
4527
4628 @Callable(i)
47-func stake () = {
48- let factory = readFactoryAddressOrFail()
49- if ((size(i.payments) != 1))
50- then throw("invalid payment - exact one payment must be attached")
51- else {
52- let pmt = i.payments[0]
53- let lpAssetId = value(pmt.assetId)
54- let lpAssetIdStr = toBase58String(lpAssetId)
55- let userAddressStr = toString(i.caller)
56- let amount = pmt.amount
57- if (!(isDefined(getString(factory, keyFactoryLp2AssetsMapping(lpAssetIdStr)))))
58- then throw(("unsupported lp asset " + lpAssetIdStr))
59- else {
60- let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr)
61- let stakedTotalKEY = keyStakedByUser(userAddressStr, lpAssetIdStr)
62- let stakedByUser = readStaked(stakedByUserKEY)
63- let stakedTotal = readStaked(stakedTotalKEY)
64-[IntegerEntry(stakedByUserKEY, (stakedByUser + amount)), IntegerEntry(stakedTotalKEY, (stakedTotal + amount)), OperationHistoryEntry("stake", userAddressStr, lpAssetIdStr, amount, i.transactionId)]
65- }
66- }
67- }
29+func currentRewardRateREADONLY (lpAssetId) = $Tuple2(nil, makeString(["%d%d%d", "320000000", "1100000000", "100000000000"], SEP))
6830
6931
7032
7133 @Callable(i)
72-func unstake (lpAssetIdStr,amount) = {
73- let factory = readFactoryAddressOrFail()
74- let userAddressStr = toString(i.caller)
75- let lpAssetId = fromBase58String(lpAssetIdStr)
76- if (!(isDefined(getString(factory, keyFactoryLp2AssetsMapping(lpAssetIdStr)))))
77- then throw(("unsupported lp asset " + lpAssetIdStr))
78- else {
79- let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr)
80- let stakedTotalKEY = keyStakedByUser(userAddressStr, lpAssetIdStr)
81- let stakedByUser = readStaked(stakedByUserKEY)
82- let stakedTotal = readStaked(stakedTotalKEY)
83- if ((amount > stakedByUser))
84- then throw("passed amount is less then available")
85- else [IntegerEntry(stakedByUserKEY, (stakedByUser - amount)), IntegerEntry(stakedTotalKEY, (stakedTotal - amount)), ScriptTransfer(i.caller, amount, lpAssetId), OperationHistoryEntry("unstake", userAddressStr, lpAssetIdStr, amount, i.transactionId)]
86- }
87- }
88-
89-
90-
91-@Callable(i)
92-func claimWx (lpAssetIdStr) = throw("temorary disabled")
93-
94-
95-
96-@Callable(i)
97-func claimWxREADONLY (lpAssetIdStr,userAddress) = $Tuple2(nil, makeString(["%s%s%d", lpAssetIdStr, userAddress, "10000500000"], SEP))
34+func currentUserRewardRateREADONLY (lpAssetId,userAddress) = $Tuple2(nil, makeString(["%d%d%d", "320000000", "1100000000", "100000000000", "1000000000", "100000000"], SEP))
9835
9936

github/deemru/w8io/169f3d6 
27.06 ms