tx · 41NjUx1m1A7kb3QBY8VFGgm1eHde7SiFNPK3QDxpfEua 3N8PYRFdwoxS9d2WT96aVK2WtUF6wLvXAmo: -0.00400000 Waves 2022.07.28 17:31 [2159793] smart account 3N8PYRFdwoxS9d2WT96aVK2WtUF6wLvXAmo > SELF 0.00000000 Waves
{ "type": 13, "id": "41NjUx1m1A7kb3QBY8VFGgm1eHde7SiFNPK3QDxpfEua", "fee": 400000, "feeAssetId": null, "timestamp": 1659018660061, "version": 2, "chainId": 84, "sender": "3N8PYRFdwoxS9d2WT96aVK2WtUF6wLvXAmo", "senderPublicKey": "9D2Gz2qTRY9jysW7Q1eDpJSQiuGHaUUfQDdspbAPrDN7", "proofs": [ "3CnPWdfqJFvgkqWWfNKSkqHWrX23vyMf7FuDgo8j5icrJrTvmybnw1GxVhenEvawb3z6G4e6PCSZ325jKWwPdKec" ], "script": "base64:AAIFAAAAAAAAABoIAhIFCgMICAgSABIDCgEBEgASBAoCCAESAAAAAAwAAAAAE2tleV9IYXNocmF0ZVRva2VuSWQCAAAAD2hhc2hyYXRlVG9rZW5JZAAAAAAQa2V5X1Byb21vVG9rZW5JZAIAAAAMcHJvbW9Ub2tlbklkAAAAAA9rZXlfU3Rha2luZ0RBcHACAAAADHN0YWtpbmctZGFwcAAAAAANa2V5X0NvbGxlY3RvcgIAAAAJY29sbGVjdG9yAAAAAAtrZXlfUmVzZXJ2ZQIAAAAHcmVzZXJ2ZQAAAAASaGFzaHJhdGVUb2tlbklkU3RyCQEAAAATdmFsdWVPckVycm9yTWVzc2FnZQAAAAIJAAQdAAAAAgUAAAAEdGhpcwUAAAATa2V5X0hhc2hyYXRlVG9rZW5JZAIAAAAAAAAAAA9oYXNocmF0ZVRva2VuSWQJAAJZAAAAAQUAAAASaGFzaHJhdGVUb2tlbklkU3RyAAAAAA9wcm9tb1Rva2VuSWRTdHIJAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAgkABB0AAAACBQAAAAR0aGlzBQAAABBrZXl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FN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgAAAANpbnYBAAAAB3Vuc3Rha2UAAAAABQAAAANuaWwAAAAAuuOUDw==", "height": 2159793, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: EMLUnGe6nuU18XmvjeABHBvG6bDcqjZ4WaLoXdd9yHt Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let key_HashrateTokenId = "hashrateTokenId" | |
5 | + | ||
6 | + | let key_PromoTokenId = "promoTokenId" | |
7 | + | ||
8 | + | let key_StakingDApp = "staking-dapp" | |
9 | + | ||
10 | + | let key_Collector = "collector" | |
11 | + | ||
12 | + | let key_Reserve = "reserve" | |
13 | + | ||
14 | + | let hashrateTokenIdStr = valueOrErrorMessage(getString(this, key_HashrateTokenId), "") | |
15 | + | ||
16 | + | let hashrateTokenId = fromBase58String(hashrateTokenIdStr) | |
17 | + | ||
18 | + | let promoTokenIdStr = valueOrErrorMessage(getString(this, key_PromoTokenId), "") | |
19 | + | ||
20 | + | let promoTokenId = fromBase58String(promoTokenIdStr) | |
21 | + | ||
22 | + | let stakingDApp = addressFromStringValue(valueOrErrorMessage(getString(this, key_StakingDApp), "")) | |
23 | + | ||
24 | + | let collector = addressFromStringValue(valueOrErrorMessage(getString(this, key_Collector), "")) | |
25 | + | ||
26 | + | let reserve = valueOrErrorMessage(getInteger(this, "reserve"), "") | |
27 | + | ||
28 | + | @Callable(inv) | |
29 | + | func init (hashrateAssetId,stakingDAppAddress,collectorAddress) = { | |
30 | + | let initAmountToBurn = 1 | |
31 | + | let issuePromo = Issue("REDSmb_Promo", "", initAmountToBurn, 8, true) | |
32 | + | 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)] | |
34 | + | } | |
35 | + | ||
36 | + | ||
37 | + | ||
38 | + | @Callable(inv) | |
39 | + | func increaseReserve () = if ((inv.caller == this)) | |
40 | + | then throw() | |
41 | + | else if ((size(inv.payments) != 1)) | |
42 | + | then throw() | |
43 | + | else if ((inv.payments[0].assetId != hashrateTokenId)) | |
44 | + | then throw() | |
45 | + | else if ((0 >= inv.payments[0].amount)) | |
46 | + | then throw() | |
47 | + | else [IntegerEntry(key_Reserve, (reserve + inv.payments[0].amount))] | |
48 | + | ||
49 | + | ||
50 | + | ||
51 | + | @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)] | |
53 | + | ||
54 | + | ||
55 | + | ||
56 | + | @Callable(inv) | |
57 | + | 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 | + | ||
59 | + | ||
60 | + | ||
61 | + | @Callable(inv) | |
62 | + | func stakePromo (rewardType,timelock) = { | |
63 | + | let staking = invoke(stakingDApp, "stake", [rewardType, timelock], [inv.payments[0]]) | |
64 | + | if ((staking == staking)) | |
65 | + | then { | |
66 | + | let stakingKey = (toString(inv.caller) + "_staked") | |
67 | + | [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 | + | } | |
69 | + | else throw("Strict value is not equal to itself.") | |
70 | + | } | |
71 | + | ||
72 | + | ||
73 | + | ||
74 | + | @Callable(inv) | |
75 | + | func unstake () = nil | |
76 | + | ||
77 | + |
github/deemru/w8io/169f3d6 33.62 ms ◑