tx · 8bEW6uZ6vPS8ahgjr7nNDVCZmQXAAabV9tHCb2dHTXZN

3N6DGohy3A1oqkBk6F4BRPHrqgkVgwxWd8g:  -0.01000000 Waves

2021.09.08 15:01 [1694040] smart account 3N6DGohy3A1oqkBk6F4BRPHrqgkVgwxWd8g > SELF 0.00000000 Waves

{ "type": 13, "id": "8bEW6uZ6vPS8ahgjr7nNDVCZmQXAAabV9tHCb2dHTXZN", "fee": 1000000, "feeAssetId": null, "timestamp": 1631102517788, "version": 1, "sender": "3N6DGohy3A1oqkBk6F4BRPHrqgkVgwxWd8g", "senderPublicKey": "AkPpYa8oqgaNXjTSuWGaMCnJ6y44pYUMeskeBjzVgPhr", "proofs": [ "2ttMNceejZb2t6UtA4AgdpNAoFM8eMwnFqRCc158M1fsQXaRZT8ZKXD6razzuH7crWnH4ABYWqjtQ1ngFPZR4VtK" ], "script": "base64:AAIFAAAAAAAAABQIAhIDCgEIEgASBAoCCAESAwoBCAAAAAwAAAAAA1NFUAIAAAACX18BAAAAD2dldFN0cmluZ09yRmFpbAAAAAEAAAADa2V5CQEAAAATdmFsdWVPckVycm9yTWVzc2FnZQAAAAIJAAQiAAAAAQUAAAADa2V5CQABLAAAAAIJAAEsAAAAAgIAAAAPbWFuZGF0b3J5IHRoaXMuBQAAAANrZXkCAAAADyBpcyBub3QgZGVmaW5lZAEAAAAYZ2V0U3RyaW5nQnlBZGRyZXNzT3JGYWlsAAAAAgAAAAdhZGRyZXNzAAAAA2tleQkBAAAAE3ZhbHVlT3JFcnJvck1lc3NhZ2UAAAACCQAEHQAAAAIFAAAAB2FkZHJlc3MFAAAAA2tleQkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAAAptYW5kYXRvcnkgCQAEJQAAAAEFAAAAB2FkZHJlc3MCAAAAAS4FAAAAA2tleQIAAAAPIGlzIG5vdCBkZWZpbmVkAQAAABFrZXlGYWN0b3J5QWRkcmVzcwAAAAACAAAAHCVzJXNfX2NvbmZpZ19fZmF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GFrZWRUb3RhbAkBAAAACnJlYWRTdGFrZWQAAAABBQAAAA5zdGFrZWRUb3RhbEtFWQMJAABmAAAAAgUAAAAGYW1vdW50BQAAAAxzdGFrZWRCeVVzZXIJAAACAAAAAQIAAAAkcGFzc2VkIGFtb3VudCBpcyBsZXNzIHRoZW4gYXZhaWxhYmxlCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACBQAAAA9zdGFrZWRCeVVzZXJLRVkJAABlAAAAAgUAAAAMc3Rha2VkQnlVc2VyBQAAAAZhbW91bnQJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIFAAAADnN0YWtlZFRvdGFsS0VZCQAAZQAAAAIFAAAAC3N0YWtlZFRvdGFsBQAAAAZhbW91bnQJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAAZhbW91bnQFAAAACWxwQXNzZXRJZAkABEwAAAACCQEAAAAVT3BlcmF0aW9uSGlzdG9yeUVudHJ5AAAABQIAAAAHdW5zdGFrZQUAAAAOdXNlckFkZHJlc3NTdHIFAAAADGxwQXNzZXRJZFN0cgUAAAAGYW1vdW50CAUAAAABaQAAAA10cmFuc2FjdGlvbklkBQAAAANuaWwAAAABaQEAAAAHY2xhaW1XeAAAAAEAAAAMbHBBc3NldElkU3RyCQAAAgAAAAECAAAAEXRlbW9yYXJ5IGRpc2FibGVkAAAAABx3U1U=", "chainId": 84, "height": 1694040, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4yXNVTb9Pk8wjQQFuweY7GGJUjdDajMYDUDFoxjSsdQy Next: BtLK3CA3yhinpuZnFYdtrw4mvMpofaaqDGPMMtRP9xBH Diff:
OldNewDifferences
6969
7070
7171 @Callable(i)
72-func claim (assetIdStr,amount) = {
72+func unstake (lpAssetIdStr,amount) = {
7373 let factory = readFactoryAddressOrFail()
7474 let userAddressStr = toString(i.caller)
75- let assetId = fromBase58String(assetIdStr)
76- if (!(isDefined(getString(factory, keyFactoryLp2AssetsMapping(assetIdStr)))))
77- then throw(("unsupported lp asset " + assetIdStr))
75+ let lpAssetId = fromBase58String(lpAssetIdStr)
76+ if (!(isDefined(getString(factory, keyFactoryLp2AssetsMapping(lpAssetIdStr)))))
77+ then throw(("unsupported lp asset " + lpAssetIdStr))
7878 else {
79- let stakedByUserKEY = keyStakedByUser(userAddressStr, assetIdStr)
80- let stakedTotalKEY = keyStakedByUser(userAddressStr, assetIdStr)
79+ let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr)
80+ let stakedTotalKEY = keyStakedByUser(userAddressStr, lpAssetIdStr)
8181 let stakedByUser = readStaked(stakedByUserKEY)
8282 let stakedTotal = readStaked(stakedTotalKEY)
8383 if ((amount > stakedByUser))
8484 then throw("passed amount is less then available")
85- else [IntegerEntry(stakedByUserKEY, (stakedByUser - amount)), IntegerEntry(stakedTotalKEY, (stakedTotal - amount)), ScriptTransfer(i.caller, amount, assetId), OperationHistoryEntry("claim", userAddressStr, assetIdStr, amount, i.transactionId)]
85+ else [IntegerEntry(stakedByUserKEY, (stakedByUser - amount)), IntegerEntry(stakedTotalKEY, (stakedTotal - amount)), ScriptTransfer(i.caller, amount, lpAssetId), OperationHistoryEntry("unstake", userAddressStr, lpAssetIdStr, amount, i.transactionId)]
8686 }
8787 }
88+
89+
90+
91+@Callable(i)
92+func claimWx (lpAssetIdStr) = throw("temorary disabled")
8893
8994
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
2121 func keyStakedByUser (userAddressStr,lpAssetIdStr) = makeString(["%s%s%s__staked", userAddressStr, lpAssetIdStr], SEP)
2222
2323
2424 func keyStakedTotal (lpAssetIdStr) = ("%s%s%s__staked__total__" + lpAssetIdStr)
2525
2626
2727 func readStaked (key) = valueOrElse(getInteger(this, key), 0)
2828
2929
3030 func keyOperationHistoryRecord (type,userAddress,txId58) = makeString(["%s%s%s%s__history", type, userAddress, txId58], SEP)
3131
3232
3333 func formatHistoryRecord (userAddress,lpAssetId,type,amount) = makeString(["%s%s%s%d%d%d", userAddress, lpAssetId, type, toString(height), toString(lastBlock.timestamp), toString(amount)], SEP)
3434
3535
3636 func OperationHistoryEntry (type,userAddress,lpAssetId,amount,txId) = StringEntry(keyOperationHistoryRecord(type, userAddress, toBase58String(txId)), formatHistoryRecord(userAddress, lpAssetId, type, amount))
3737
3838
3939 @Callable(i)
4040 func constructor (factoryAddressStr) = if ((i.caller != this))
4141 then throw("not authorized")
4242 else [StringEntry(keyFactoryAddress(), factoryAddressStr)]
4343
4444
4545
4646 @Callable(i)
4747 func stake () = {
4848 let factory = readFactoryAddressOrFail()
4949 if ((size(i.payments) != 1))
5050 then throw("invalid payment - exact one payment must be attached")
5151 else {
5252 let pmt = i.payments[0]
5353 let lpAssetId = value(pmt.assetId)
5454 let lpAssetIdStr = toBase58String(lpAssetId)
5555 let userAddressStr = toString(i.caller)
5656 let amount = pmt.amount
5757 if (!(isDefined(getString(factory, keyFactoryLp2AssetsMapping(lpAssetIdStr)))))
5858 then throw(("unsupported lp asset " + lpAssetIdStr))
5959 else {
6060 let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr)
6161 let stakedTotalKEY = keyStakedByUser(userAddressStr, lpAssetIdStr)
6262 let stakedByUser = readStaked(stakedByUserKEY)
6363 let stakedTotal = readStaked(stakedTotalKEY)
6464 [IntegerEntry(stakedByUserKEY, (stakedByUser + amount)), IntegerEntry(stakedTotalKEY, (stakedTotal + amount)), OperationHistoryEntry("stake", userAddressStr, lpAssetIdStr, amount, i.transactionId)]
6565 }
6666 }
6767 }
6868
6969
7070
7171 @Callable(i)
72-func claim (assetIdStr,amount) = {
72+func unstake (lpAssetIdStr,amount) = {
7373 let factory = readFactoryAddressOrFail()
7474 let userAddressStr = toString(i.caller)
75- let assetId = fromBase58String(assetIdStr)
76- if (!(isDefined(getString(factory, keyFactoryLp2AssetsMapping(assetIdStr)))))
77- then throw(("unsupported lp asset " + assetIdStr))
75+ let lpAssetId = fromBase58String(lpAssetIdStr)
76+ if (!(isDefined(getString(factory, keyFactoryLp2AssetsMapping(lpAssetIdStr)))))
77+ then throw(("unsupported lp asset " + lpAssetIdStr))
7878 else {
79- let stakedByUserKEY = keyStakedByUser(userAddressStr, assetIdStr)
80- let stakedTotalKEY = keyStakedByUser(userAddressStr, assetIdStr)
79+ let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr)
80+ let stakedTotalKEY = keyStakedByUser(userAddressStr, lpAssetIdStr)
8181 let stakedByUser = readStaked(stakedByUserKEY)
8282 let stakedTotal = readStaked(stakedTotalKEY)
8383 if ((amount > stakedByUser))
8484 then throw("passed amount is less then available")
85- else [IntegerEntry(stakedByUserKEY, (stakedByUser - amount)), IntegerEntry(stakedTotalKEY, (stakedTotal - amount)), ScriptTransfer(i.caller, amount, assetId), OperationHistoryEntry("claim", userAddressStr, assetIdStr, amount, i.transactionId)]
85+ else [IntegerEntry(stakedByUserKEY, (stakedByUser - amount)), IntegerEntry(stakedTotalKEY, (stakedTotal - amount)), ScriptTransfer(i.caller, amount, lpAssetId), OperationHistoryEntry("unstake", userAddressStr, lpAssetIdStr, amount, i.transactionId)]
8686 }
8787 }
88+
89+
90+
91+@Callable(i)
92+func claimWx (lpAssetIdStr) = throw("temorary disabled")
8893
8994

github/deemru/w8io/169f3d6 
28.47 ms