tx · EMLUnGe6nuU18XmvjeABHBvG6bDcqjZ4WaLoXdd9yHt

3N8PYRFdwoxS9d2WT96aVK2WtUF6wLvXAmo:  -0.00500000 Waves

2022.08.01 15:29 [2165432] smart account 3N8PYRFdwoxS9d2WT96aVK2WtUF6wLvXAmo > SELF 0.00000000 Waves

{ "type": 13, "id": "EMLUnGe6nuU18XmvjeABHBvG6bDcqjZ4WaLoXdd9yHt", "fee": 500000, "feeAssetId": null, "timestamp": 1659357003098, "version": 2, "chainId": 84, "sender": "3N8PYRFdwoxS9d2WT96aVK2WtUF6wLvXAmo", "senderPublicKey": "9D2Gz2qTRY9jysW7Q1eDpJSQiuGHaUUfQDdspbAPrDN7", "proofs": [ "2cQNYCmXjFJiT15E1NJhjxswVJ3w8ziRVqKA2uqdbGfNz7EwsXHScXWerV6VEHs5QYDhtuMY68EbiB4RkCDsJsiv" ], "script": "base64:AAIFAAAAAAAAABoIAhIFCgMICAgSABIDCgEBEgASBAoCCAESAAAAAA4AAAAAE2tleV9IYXNocmF0ZVRva2VuSWQCAAAAD2hhc2hyYXRlVG9rZW5JZAAAAAAQa2V5X1Byb21vVG9rZW5JZAIAAAAMcHJvbW9Ub2tlbklkAAAAAA9rZXlfU3Rha2luZ0RBcHACAAAADHN0YWtpbmctZGFwcAAAAAANa2V5X0NvbGxlY3RvcgIAAAAJY29sbGVjdG9yAAAAAAtrZXlfUmVzZXJ2ZQIAAAAHcmVzZXJ2ZQAAAAAPa2V5X1Byb21vSXNzdWVkAgAAAAxwcm9tby1pc3N1ZWQAAAAAEmhhc2hyYXRlVG9rZW5JZFN0cgkBAAAAE3ZhbHVlT3JFcnJvck1lc3NhZ2UAAAACCQAEHQAAAAIFAAAABHRoaXMFAAAAE2tleV9IYXNocmF0ZVRva2VuSWQCAAAAAAAAAAAPaGFzaHJhdGVUb2tlbklkCQACWQAAAAEFAAAAEmhhc2hyYXRlVG9rZW5JZFN0cgAAAAAPcHJvbW9Ub2tlbklkU3RyCQEAAAATdmFsd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jawQAAAAHc3Rha2luZwkAA/wAAAAEBQAAAAtzdGFraW5nREFwcAIAAAAFc3Rha2UJAARMAAAAAgUAAAAKcmV3YXJkVHlwZQkABEwAAAACBQAAAAh0aW1lbG9jawUAAAADbmlsCQAETAAAAAIJAAGRAAAAAggFAAAAA2ludgAAAAhwYXltZW50cwAAAAAAAAAAAAUAAAADbmlsAwkAAAAAAAACBQAAAAdzdGFraW5nBQAAAAdzdGFraW5nBAAAAApzdGFraW5nS2V5CQABLAAAAAIJAAQlAAAAAQgFAAAAA2ludgAAAAZjYWxsZXICAAAAB19zdGFrZWQJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIFAAAACnN0YWtpbmdLZXkJAABkAAAAAgkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkABBoAAAACBQAAAAR0aGlzBQAAAApzdGFraW5nS2V5AAAAAAAAAAAACAkAAZEAAAACCAUAAAADaW52AAAACHBheW1lbnRzAAAAAAAAAAAAAAAABmFtb3VudAkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgkABCUAAAABCAUAAAADaW52AAAABmNhbGxlcgIAAAABXwkAAlgAAAABCAUAAAADaW52AAAADXRyYW5zYWN0aW9uSWQJAAEsAAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAAaQAAAABCAkAAZEAAAACCAUAAAADaW52AAAACHBheW1lbnRzAAAAAAAAAAAAAAAABmFtb3VudAIAAAABLAUAAAAKcmV3YXJkVHlwZQIAAAABLAkAAaQAAAABBQAAAAh0aW1lbG9jawUAAAADbmlsCQAAAgAAAAECAAAAJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgAAAANpbnYBAAAAB3Vuc3Rha2UAAAAABQAAAANuaWwAAAAAbw0D3g==", "height": 2165432, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 41NjUx1m1A7kb3QBY8VFGgm1eHde7SiFNPK3QDxpfEua Next: 6DFWrB3DikRbGFuk3XNETFvQVsaNRpYnc5EN3riAfz7D Diff:
OldNewDifferences
1111
1212 let key_Reserve = "reserve"
1313
14+let key_PromoIssued = "promo-issued"
15+
1416 let hashrateTokenIdStr = valueOrErrorMessage(getString(this, key_HashrateTokenId), "")
1517
1618 let hashrateTokenId = fromBase58String(hashrateTokenIdStr)
2325
2426 let collector = addressFromStringValue(valueOrErrorMessage(getString(this, key_Collector), ""))
2527
26-let reserve = valueOrErrorMessage(getInteger(this, "reserve"), "")
28+let reserve = valueOrErrorMessage(getInteger(this, key_Reserve), "")
29+
30+let promoIssued = valueOrErrorMessage(getInteger(this, key_PromoIssued), "")
2731
2832 @Callable(inv)
2933 func init (hashrateAssetId,stakingDAppAddress,collectorAddress) = {
3034 let initAmountToBurn = 1
3135 let issuePromo = Issue("REDSmb_Promo", "", initAmountToBurn, 8, true)
3236 let promoId = calculateAssetId(issuePromo)
33-[StringEntry(key_HashrateTokenId, toBase58String(valueOrErrorMessage(assetInfo(fromBase58String(hashrateAssetId)), "").id)), StringEntry(key_StakingDApp, toString(valueOrErrorMessage(addressFromString(stakingDAppAddress), ""))), StringEntry(key_Collector, toString(valueOrErrorMessage(addressFromString(collectorAddress), ""))), issuePromo, Burn(promoId, initAmountToBurn), StringEntry(key_PromoTokenId, toBase58String(promoId)), IntegerEntry(key_Reserve, 0)]
37+[StringEntry(key_HashrateTokenId, toBase58String(valueOrErrorMessage(assetInfo(fromBase58String(hashrateAssetId)), "").id)), StringEntry(key_StakingDApp, toString(valueOrErrorMessage(addressFromString(stakingDAppAddress), ""))), StringEntry(key_Collector, toString(valueOrErrorMessage(addressFromString(collectorAddress), ""))), IntegerEntry(key_Reserve, 0), IntegerEntry(key_PromoIssued, 0), issuePromo, Burn(promoId, initAmountToBurn), StringEntry(key_PromoTokenId, toBase58String(promoId)), IntegerEntry(key_Reserve, 0)]
3438 }
3539
3640
4953
5054
5155 @Callable(inv)
52-func buyPromo (amountOfPromoTokens) = [IntegerEntry("promo-issued", (valueOrElse(getInteger(this, "promo-issued"), 0) + amountOfPromoTokens)), ScriptTransfer(collector, inv.payments[0].amount, inv.payments[0].assetId), ScriptTransfer(inv.caller, amountOfPromoTokens, promoTokenId)]
56+func buyPromo (amountOfPromoTokens) = if ((size(inv.payments) != 1))
57+ then throw("WAVES payment required")
58+ else if (isDefined(inv.payments[0].assetId))
59+ then throw("Only WAVES payment accepted!")
60+ else if ((0 >= inv.payments[0].amount))
61+ then throw("Payment amount must be positive")
62+ else if ((amountOfPromoTokens > (reserve - promoIssued)))
63+ then throw("")
64+ else [IntegerEntry(key_PromoIssued, (promoIssued + amountOfPromoTokens)), Reissue(promoTokenId, amountOfPromoTokens, true), ScriptTransfer(collector, inv.payments[0].amount, inv.payments[0].assetId), ScriptTransfer(inv.caller, amountOfPromoTokens, promoTokenId)]
5365
5466
5567
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let key_HashrateTokenId = "hashrateTokenId"
55
66 let key_PromoTokenId = "promoTokenId"
77
88 let key_StakingDApp = "staking-dapp"
99
1010 let key_Collector = "collector"
1111
1212 let key_Reserve = "reserve"
1313
14+let key_PromoIssued = "promo-issued"
15+
1416 let hashrateTokenIdStr = valueOrErrorMessage(getString(this, key_HashrateTokenId), "")
1517
1618 let hashrateTokenId = fromBase58String(hashrateTokenIdStr)
1719
1820 let promoTokenIdStr = valueOrErrorMessage(getString(this, key_PromoTokenId), "")
1921
2022 let promoTokenId = fromBase58String(promoTokenIdStr)
2123
2224 let stakingDApp = addressFromStringValue(valueOrErrorMessage(getString(this, key_StakingDApp), ""))
2325
2426 let collector = addressFromStringValue(valueOrErrorMessage(getString(this, key_Collector), ""))
2527
26-let reserve = valueOrErrorMessage(getInteger(this, "reserve"), "")
28+let reserve = valueOrErrorMessage(getInteger(this, key_Reserve), "")
29+
30+let promoIssued = valueOrErrorMessage(getInteger(this, key_PromoIssued), "")
2731
2832 @Callable(inv)
2933 func init (hashrateAssetId,stakingDAppAddress,collectorAddress) = {
3034 let initAmountToBurn = 1
3135 let issuePromo = Issue("REDSmb_Promo", "", initAmountToBurn, 8, true)
3236 let promoId = calculateAssetId(issuePromo)
33-[StringEntry(key_HashrateTokenId, toBase58String(valueOrErrorMessage(assetInfo(fromBase58String(hashrateAssetId)), "").id)), StringEntry(key_StakingDApp, toString(valueOrErrorMessage(addressFromString(stakingDAppAddress), ""))), StringEntry(key_Collector, toString(valueOrErrorMessage(addressFromString(collectorAddress), ""))), issuePromo, Burn(promoId, initAmountToBurn), StringEntry(key_PromoTokenId, toBase58String(promoId)), IntegerEntry(key_Reserve, 0)]
37+[StringEntry(key_HashrateTokenId, toBase58String(valueOrErrorMessage(assetInfo(fromBase58String(hashrateAssetId)), "").id)), StringEntry(key_StakingDApp, toString(valueOrErrorMessage(addressFromString(stakingDAppAddress), ""))), StringEntry(key_Collector, toString(valueOrErrorMessage(addressFromString(collectorAddress), ""))), IntegerEntry(key_Reserve, 0), IntegerEntry(key_PromoIssued, 0), issuePromo, Burn(promoId, initAmountToBurn), StringEntry(key_PromoTokenId, toBase58String(promoId)), IntegerEntry(key_Reserve, 0)]
3438 }
3539
3640
3741
3842 @Callable(inv)
3943 func increaseReserve () = if ((inv.caller == this))
4044 then throw()
4145 else if ((size(inv.payments) != 1))
4246 then throw()
4347 else if ((inv.payments[0].assetId != hashrateTokenId))
4448 then throw()
4549 else if ((0 >= inv.payments[0].amount))
4650 then throw()
4751 else [IntegerEntry(key_Reserve, (reserve + inv.payments[0].amount))]
4852
4953
5054
5155 @Callable(inv)
52-func buyPromo (amountOfPromoTokens) = [IntegerEntry("promo-issued", (valueOrElse(getInteger(this, "promo-issued"), 0) + amountOfPromoTokens)), ScriptTransfer(collector, inv.payments[0].amount, inv.payments[0].assetId), ScriptTransfer(inv.caller, amountOfPromoTokens, promoTokenId)]
56+func buyPromo (amountOfPromoTokens) = if ((size(inv.payments) != 1))
57+ then throw("WAVES payment required")
58+ else if (isDefined(inv.payments[0].assetId))
59+ then throw("Only WAVES payment accepted!")
60+ else if ((0 >= inv.payments[0].amount))
61+ then throw("Payment amount must be positive")
62+ else if ((amountOfPromoTokens > (reserve - promoIssued)))
63+ then throw("")
64+ else [IntegerEntry(key_PromoIssued, (promoIssued + amountOfPromoTokens)), Reissue(promoTokenId, amountOfPromoTokens, true), ScriptTransfer(collector, inv.payments[0].amount, inv.payments[0].assetId), ScriptTransfer(inv.caller, amountOfPromoTokens, promoTokenId)]
5365
5466
5567
5668 @Callable(inv)
5769 func redeemHashrateToken () = [Burn(valueOrErrorMessage(inv.payments[1].assetId, ""), inv.payments[1].amount), ScriptTransfer(collector, inv.payments[0].amount, inv.payments[0].assetId), ScriptTransfer(inv.caller, inv.payments[1].amount, hashrateTokenId)]
5870
5971
6072
6173 @Callable(inv)
6274 func stakePromo (rewardType,timelock) = {
6375 let staking = invoke(stakingDApp, "stake", [rewardType, timelock], [inv.payments[0]])
6476 if ((staking == staking))
6577 then {
6678 let stakingKey = (toString(inv.caller) + "_staked")
6779 [IntegerEntry(stakingKey, (valueOrElse(getInteger(this, stakingKey), 0) + inv.payments[0].amount)), StringEntry(((toString(inv.caller) + "_") + toBase58String(inv.transactionId)), ((((toString(inv.payments[0].amount) + ",") + rewardType) + ",") + toString(timelock)))]
6880 }
6981 else throw("Strict value is not equal to itself.")
7082 }
7183
7284
7385
7486 @Callable(inv)
7587 func unstake () = nil
7688
7789

github/deemru/w8io/169f3d6 
35.02 ms