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:AAIFAAAAAAAAABoIAhIFCgMICAgSABIDCgEBEgASBAoCCAESAAAAAA4AAAAAE2tleV9IYXNocmF0ZVRva2VuSWQCAAAAD2hhc2hyYXRlVG9rZW5JZAAAAAAQa2V5X1Byb21vVG9rZW5JZAIAAAAMcHJvbW9Ub2tlbklkAAAAAA9rZXlfU3Rha2luZ0RBcHACAAAADHN0YWtpbmctZGFwcAAAAAANa2V5X0NvbGxlY3RvcgIAAAAJY29sbGVjdG9yAAAAAAtrZXlfUmVzZXJ2ZQIAAAAHcmVzZXJ2ZQAAAAAPa2V5X1Byb21vSXNzdWVkAgAAAAxwcm9tby1pc3N1ZWQAAAAAEmhhc2hyYXRlVG9rZW5JZFN0cgkBAAAAE3ZhbHVlT3JFcnJvck1lc3NhZ2UAAAACCQAEHQAAAAIFAAAABHRoaXMFAAAAE2tleV9IYXNocmF0ZVRva2VuSWQCAAAAAAAAAAAPaGFzaHJhdGVUb2tlbklkCQACWQAAAAEFAAAAEmhhc2hyYXRlVG9rZW5JZFN0cgAAAAAPcHJvbW9Ub2tlbklkU3RyCQEAAAATdmFsdW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awQAAAAHc3Rha2luZwkAA/wAAAAEBQAAAAtzdGFraW5nREFwcAIAAAAFc3Rha2UJAARMAAAAAgUAAAAKcmV3YXJkVHlwZQkABEwAAAACBQAAAAh0aW1lbG9jawUAAAADbmlsCQAETAAAAAIJAAGRAAAAAggFAAAAA2ludgAAAAhwYXltZW50cwAAAAAAAAAAAAUAAAADbmlsAwkAAAAAAAACBQAAAAdzdGFraW5nBQAAAAdzdGFraW5nBAAAAApzdGFraW5nS2V5CQABLAAAAAIJAAQlAAAAAQgFAAAAA2ludgAAAAZjYWxsZXICAAAAB19zdGFrZWQJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIFAAAACnN0YWtpbmdLZXkJAABkAAAAAgkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkABBoAAAACBQAAAAR0aGlzBQAAAApzdGFraW5nS2V5AAAAAAAAAAAACAkAAZEAAAACCAUAAAADaW52AAAACHBheW1lbnRzAAAAAAAAAAAAAAAABmFtb3VudAkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgkABCUAAAABCAUAAAADaW52AAAABmNhbGxlcgIAAAABXwkAAlgAAAABCAUAAAADaW52AAAADXRyYW5zYWN0aW9uSWQJAAEsAAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAAaQAAAABCAkAAZEAAAACCAUAAAADaW52AAAACHBheW1lbnRzAAAAAAAAAAAAAAAABmFtb3VudAIAAAABLAUAAAAKcmV3YXJkVHlwZQIAAAABLAkAAaQAAAABBQAAAAh0aW1lbG9jawUAAAADbmlsCQAAAgAAAAECAAAAJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgAAAANpbnYBAAAAB3Vuc3Rha2UAAAAABQAAAANuaWwAAAAAbw0D3g==", "height": 2165432, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 41NjUx1m1A7kb3QBY8VFGgm1eHde7SiFNPK3QDxpfEua Next: 6DFWrB3DikRbGFuk3XNETFvQVsaNRpYnc5EN3riAfz7D Diff:
Old | New | Differences | |
---|---|---|---|
11 | 11 | ||
12 | 12 | let key_Reserve = "reserve" | |
13 | 13 | ||
14 | + | let key_PromoIssued = "promo-issued" | |
15 | + | ||
14 | 16 | let hashrateTokenIdStr = valueOrErrorMessage(getString(this, key_HashrateTokenId), "") | |
15 | 17 | ||
16 | 18 | let hashrateTokenId = fromBase58String(hashrateTokenIdStr) | |
23 | 25 | ||
24 | 26 | let collector = addressFromStringValue(valueOrErrorMessage(getString(this, key_Collector), "")) | |
25 | 27 | ||
26 | - | let reserve = valueOrErrorMessage(getInteger(this, "reserve"), "") | |
28 | + | let reserve = valueOrErrorMessage(getInteger(this, key_Reserve), "") | |
29 | + | ||
30 | + | let promoIssued = valueOrErrorMessage(getInteger(this, key_PromoIssued), "") | |
27 | 31 | ||
28 | 32 | @Callable(inv) | |
29 | 33 | func init (hashrateAssetId,stakingDAppAddress,collectorAddress) = { | |
30 | 34 | let initAmountToBurn = 1 | |
31 | 35 | let issuePromo = Issue("REDSmb_Promo", "", initAmountToBurn, 8, true) | |
32 | 36 | 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)] | |
34 | 38 | } | |
35 | 39 | ||
36 | 40 | ||
49 | 53 | ||
50 | 54 | ||
51 | 55 | @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)] | |
53 | 65 | ||
54 | 66 | ||
55 | 67 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let key_HashrateTokenId = "hashrateTokenId" | |
5 | 5 | ||
6 | 6 | let key_PromoTokenId = "promoTokenId" | |
7 | 7 | ||
8 | 8 | let key_StakingDApp = "staking-dapp" | |
9 | 9 | ||
10 | 10 | let key_Collector = "collector" | |
11 | 11 | ||
12 | 12 | let key_Reserve = "reserve" | |
13 | 13 | ||
14 | + | let key_PromoIssued = "promo-issued" | |
15 | + | ||
14 | 16 | let hashrateTokenIdStr = valueOrErrorMessage(getString(this, key_HashrateTokenId), "") | |
15 | 17 | ||
16 | 18 | let hashrateTokenId = fromBase58String(hashrateTokenIdStr) | |
17 | 19 | ||
18 | 20 | let promoTokenIdStr = valueOrErrorMessage(getString(this, key_PromoTokenId), "") | |
19 | 21 | ||
20 | 22 | let promoTokenId = fromBase58String(promoTokenIdStr) | |
21 | 23 | ||
22 | 24 | let stakingDApp = addressFromStringValue(valueOrErrorMessage(getString(this, key_StakingDApp), "")) | |
23 | 25 | ||
24 | 26 | let collector = addressFromStringValue(valueOrErrorMessage(getString(this, key_Collector), "")) | |
25 | 27 | ||
26 | - | let reserve = valueOrErrorMessage(getInteger(this, "reserve"), "") | |
28 | + | let reserve = valueOrErrorMessage(getInteger(this, key_Reserve), "") | |
29 | + | ||
30 | + | let promoIssued = valueOrErrorMessage(getInteger(this, key_PromoIssued), "") | |
27 | 31 | ||
28 | 32 | @Callable(inv) | |
29 | 33 | func init (hashrateAssetId,stakingDAppAddress,collectorAddress) = { | |
30 | 34 | let initAmountToBurn = 1 | |
31 | 35 | let issuePromo = Issue("REDSmb_Promo", "", initAmountToBurn, 8, true) | |
32 | 36 | 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)] | |
34 | 38 | } | |
35 | 39 | ||
36 | 40 | ||
37 | 41 | ||
38 | 42 | @Callable(inv) | |
39 | 43 | func increaseReserve () = if ((inv.caller == this)) | |
40 | 44 | then throw() | |
41 | 45 | else if ((size(inv.payments) != 1)) | |
42 | 46 | then throw() | |
43 | 47 | else if ((inv.payments[0].assetId != hashrateTokenId)) | |
44 | 48 | then throw() | |
45 | 49 | else if ((0 >= inv.payments[0].amount)) | |
46 | 50 | then throw() | |
47 | 51 | else [IntegerEntry(key_Reserve, (reserve + inv.payments[0].amount))] | |
48 | 52 | ||
49 | 53 | ||
50 | 54 | ||
51 | 55 | @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)] | |
53 | 65 | ||
54 | 66 | ||
55 | 67 | ||
56 | 68 | @Callable(inv) | |
57 | 69 | 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)] | |
58 | 70 | ||
59 | 71 | ||
60 | 72 | ||
61 | 73 | @Callable(inv) | |
62 | 74 | func stakePromo (rewardType,timelock) = { | |
63 | 75 | let staking = invoke(stakingDApp, "stake", [rewardType, timelock], [inv.payments[0]]) | |
64 | 76 | if ((staking == staking)) | |
65 | 77 | then { | |
66 | 78 | let stakingKey = (toString(inv.caller) + "_staked") | |
67 | 79 | [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)))] | |
68 | 80 | } | |
69 | 81 | else throw("Strict value is not equal to itself.") | |
70 | 82 | } | |
71 | 83 | ||
72 | 84 | ||
73 | 85 | ||
74 | 86 | @Callable(inv) | |
75 | 87 | func unstake () = nil | |
76 | 88 | ||
77 | 89 |
github/deemru/w8io/169f3d6 35.02 ms ◑