tx · AwmD1VSDeLiiGkanKpCSH7z8Dk2tXBaFhA2VvYEUj9ed
3N2D6tJAXzcTDgUiTWmcdCHd6ctYwNENuBn: -0.01000000 Waves
2022.11.01 14:59 [2298017] smart account 3N2D6tJAXzcTDgUiTWmcdCHd6ctYwNENuBn > SELF 0.00000000 Waves
{
"type": 13,
"id": "AwmD1VSDeLiiGkanKpCSH7z8Dk2tXBaFhA2VvYEUj9ed",
"fee": 1000000,
"feeAssetId": null,
"timestamp": 1667303997970,
"version": 2,
"chainId": 84,
"sender": "3N2D6tJAXzcTDgUiTWmcdCHd6ctYwNENuBn",
"senderPublicKey": "Cq4RbcVcQJpCWyHiACDqUf2PbU8PaX949Dun9wRSeDzE",
"proofs": [
"53LEZmAo1QvPZ7kbxVho1BK7NM8nUAs5BqU8QCNbhMtBmc9ShSNgLNDJ6jpu2FmdMzXXafsMfxyTbPZYj5cpCf8K"
],
"script": "base64:AAIFAAAAAAAAAA0IAhIECgIICBIDCgEIAAAACgAAAAAKbmZ0QXNzZXRJZAEAAAAAAAAAABBpbmN1YmF0b3JBZGRyZXNzAQAAAAAAAAAAC3VzZXJBZGRyZXNzAQAAAAAAAAAAF2NvbGxlY3RpdmVNYXN0ZXJBZGRyZXNzAQAAAAAAAAAABXJlZjIwCQAETAAAAAICAAAAAAUAAAADbmlsAQAAAA10cnlHZXRJbnRlZ2VyAAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWIFAAAAByRtYXRjaDAFAAAAAWIAAAAAAAAAAAABAAAAE21hc3RlclRyeUdldEJvb2xlYW4AAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABBsAAAACCQEAAAAHQWRkcmVzcwAAAAEFAAAAF2NvbGxlY3RpdmVNYXN0ZXJBZGRyZXNzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAB0Jvb2xlYW4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5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXlDNE+d",
"height": 2298017,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: 4oCboyW3iKd9zTC8rQ1LM8YrYjvKXiUMDdTPVih4hYb6
Next: 2w8iJnTuhU5C8iwpPVLCaxofMDUiDqZKYV9Fx67Gp5hV
Diff:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 5 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | | - | let eggsAssetId = base58'JCGDtrVy64cCJ1wCKfCaiNQMnyYwii71TbE5QeAHfxgF' |
---|
| 4 | + | let nftAssetId = base58'' |
---|
5 | 5 | | |
---|
6 | | - | let incubatorAddress = base58'3PEktVux2RhchSN63DsDo4b4mz4QqzKSeDv' |
---|
| 6 | + | let incubatorAddress = base58'' |
---|
7 | 7 | | |
---|
8 | | - | let farmingAddress = base58'3PAETTtuW7aSiyKtn9GuML3RgtV1xdq1mQW' |
---|
| 8 | + | let userAddress = base58'' |
---|
9 | 9 | | |
---|
10 | | - | let collectiveMasterAddress = base58'3PDktsxDVEcoobpEBJcausnKo4enhcWUDEF' |
---|
| 10 | + | let collectiveMasterAddress = base58'' |
---|
11 | 11 | | |
---|
12 | | - | let ref20 = ["3PR66kMvUDE1QvYAg8r6e1xDX7QbnTV7JW5"] |
---|
| 12 | + | let ref20 = [""] |
---|
13 | 13 | | |
---|
14 | 14 | | func tryGetInteger (key) = match getInteger(this, key) { |
---|
15 | 15 | | case b: Int => |
---|
|
43 | 43 | | } |
---|
44 | 44 | | |
---|
45 | 45 | | |
---|
46 | | - | func getRefMultiplier (refererAddress) = if ((indexOf(ref20, refererAddress) != unit)) |
---|
| 46 | + | func getRefMultiplier (gatewayAddress) = if ((indexOf(ref20, gatewayAddress) != unit)) |
---|
47 | 47 | | then 4 |
---|
48 | 48 | | else 1 |
---|
49 | 49 | | |
---|
50 | 50 | | |
---|
51 | 51 | | @Callable(i) |
---|
52 | | - | func addRefKey (refererAddress,refererKey) = if ((i.caller != this)) |
---|
| 52 | + | func addgatewayKey (gatewayAddress,gatewayKey) = if ((i.caller != this)) |
---|
53 | 53 | | then throw("admin only") |
---|
54 | 54 | | else { |
---|
55 | | - | let refStateKey = (("key_" + refererKey) + "_refererAddress") |
---|
| 55 | + | let refStateKey = (("key_" + gatewayKey) + "_refererAddress") |
---|
56 | 56 | | if ((tryGetString(refStateKey) == "")) |
---|
57 | | - | then [StringEntry(refStateKey, refererAddress), StringEntry(((("address_" + refererAddress) + "_refererKey_") + refererKey), refererKey)] |
---|
58 | | - | else throw((("The ref key \"" + refererKey) + "\" is already registered")) |
---|
| 57 | + | then [StringEntry(refStateKey, gatewayAddress), StringEntry(((("address_" + gatewayAddress) + "_refererKey_") + gatewayKey), gatewayKey)] |
---|
| 58 | + | else throw((("The ref key \"" + gatewayKey) + "\" is already registered")) |
---|
59 | 59 | | } |
---|
60 | 60 | | |
---|
61 | 61 | | |
---|
62 | 62 | | |
---|
63 | 63 | | @Callable(i) |
---|
64 | | - | func refPayment (refererKey) = { |
---|
| 64 | + | func gatewayreward (refererKey) = { |
---|
65 | 65 | | let referalAddress = toString(i.originCaller) |
---|
66 | 66 | | if (if ((i.caller.bytes != incubatorAddress)) |
---|
67 | | - | then (i.caller.bytes != farmingAddress) |
---|
| 67 | + | then (i.caller.bytes != userAddress) |
---|
68 | 68 | | else false) |
---|
69 | 69 | | then throw("This method can be called only by farming and incubator dApps") |
---|
70 | 70 | | else if (if ((refererKey == "")) |
---|
71 | 71 | | then (tryGetString((("address_" + referalAddress) + "_referedBy")) == "") |
---|
72 | 72 | | else false) |
---|
73 | 73 | | then nil |
---|
74 | | - | else if (masterTryGetBoolean(("farm_" + referalAddress))) |
---|
| 74 | + | else if (masterTryGetBoolean(("gateway_" + referalAddress))) |
---|
75 | 75 | | then nil |
---|
76 | 76 | | else { |
---|
77 | 77 | | let givenReferer = match getString(this, (("key_" + refererKey) + "_refererAddress")) { |
---|
|
97 | 97 | | let referalDeliveredReward = (((("referer_" + refererAddress) + "_referal_") + referalAddress) + "_deliveredReward") |
---|
98 | 98 | | if ((refererAddress == referalAddress)) |
---|
99 | 99 | | then nil |
---|
100 | | - | else [StringEntry((("address_" + referalAddress) + "_referedBy"), refererAddress), IntegerEntry(refererEarnedReward, (tryGetInteger(refererEarnedReward) + paymentForReferer)), IntegerEntry(referalDeliveredReward, (tryGetInteger(referalDeliveredReward) + paymentForReferer)), IntegerEntry((((("referer_" + refererAddress) + "_referal_") + referalAddress) + "_amount"), (tryGetInteger((((("referer_" + refererAddress) + "_referal_") + referalAddress) + "_amount")) + 1)), ScriptTransfer(refererAddressValue, paymentForReferer, eggsAssetId)] |
---|
| 100 | + | else [StringEntry((("address_" + referalAddress) + "_referedBy"), refererAddress), IntegerEntry(refererEarnedReward, (tryGetInteger(refererEarnedReward) + paymentForReferer)), IntegerEntry(referalDeliveredReward, (tryGetInteger(referalDeliveredReward) + paymentForReferer)), IntegerEntry((((("referer_" + refererAddress) + "_referal_") + referalAddress) + "_amount"), (tryGetInteger((((("referer_" + refererAddress) + "_referal_") + referalAddress) + "_amount")) + 1)), ScriptTransfer(refererAddressValue, paymentForReferer, userAddress)] |
---|
101 | 101 | | } |
---|
102 | 102 | | } |
---|
103 | 103 | | } |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 5 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | | - | let eggsAssetId = base58'JCGDtrVy64cCJ1wCKfCaiNQMnyYwii71TbE5QeAHfxgF' |
---|
| 4 | + | let nftAssetId = base58'' |
---|
5 | 5 | | |
---|
6 | | - | let incubatorAddress = base58'3PEktVux2RhchSN63DsDo4b4mz4QqzKSeDv' |
---|
| 6 | + | let incubatorAddress = base58'' |
---|
7 | 7 | | |
---|
8 | | - | let farmingAddress = base58'3PAETTtuW7aSiyKtn9GuML3RgtV1xdq1mQW' |
---|
| 8 | + | let userAddress = base58'' |
---|
9 | 9 | | |
---|
10 | | - | let collectiveMasterAddress = base58'3PDktsxDVEcoobpEBJcausnKo4enhcWUDEF' |
---|
| 10 | + | let collectiveMasterAddress = base58'' |
---|
11 | 11 | | |
---|
12 | | - | let ref20 = ["3PR66kMvUDE1QvYAg8r6e1xDX7QbnTV7JW5"] |
---|
| 12 | + | let ref20 = [""] |
---|
13 | 13 | | |
---|
14 | 14 | | func tryGetInteger (key) = match getInteger(this, key) { |
---|
15 | 15 | | case b: Int => |
---|
16 | 16 | | b |
---|
17 | 17 | | case _ => |
---|
18 | 18 | | 0 |
---|
19 | 19 | | } |
---|
20 | 20 | | |
---|
21 | 21 | | |
---|
22 | 22 | | func masterTryGetBoolean (key) = match getBoolean(Address(collectiveMasterAddress), key) { |
---|
23 | 23 | | case b: Boolean => |
---|
24 | 24 | | b |
---|
25 | 25 | | case _ => |
---|
26 | 26 | | false |
---|
27 | 27 | | } |
---|
28 | 28 | | |
---|
29 | 29 | | |
---|
30 | 30 | | func isValidAddress (address) = match addressFromString(address) { |
---|
31 | 31 | | case a: Address => |
---|
32 | 32 | | true |
---|
33 | 33 | | case _ => |
---|
34 | 34 | | false |
---|
35 | 35 | | } |
---|
36 | 36 | | |
---|
37 | 37 | | |
---|
38 | 38 | | func tryGetString (key) = match getString(this, key) { |
---|
39 | 39 | | case a: String => |
---|
40 | 40 | | a |
---|
41 | 41 | | case _ => |
---|
42 | 42 | | "" |
---|
43 | 43 | | } |
---|
44 | 44 | | |
---|
45 | 45 | | |
---|
46 | | - | func getRefMultiplier (refererAddress) = if ((indexOf(ref20, refererAddress) != unit)) |
---|
| 46 | + | func getRefMultiplier (gatewayAddress) = if ((indexOf(ref20, gatewayAddress) != unit)) |
---|
47 | 47 | | then 4 |
---|
48 | 48 | | else 1 |
---|
49 | 49 | | |
---|
50 | 50 | | |
---|
51 | 51 | | @Callable(i) |
---|
52 | | - | func addRefKey (refererAddress,refererKey) = if ((i.caller != this)) |
---|
| 52 | + | func addgatewayKey (gatewayAddress,gatewayKey) = if ((i.caller != this)) |
---|
53 | 53 | | then throw("admin only") |
---|
54 | 54 | | else { |
---|
55 | | - | let refStateKey = (("key_" + refererKey) + "_refererAddress") |
---|
| 55 | + | let refStateKey = (("key_" + gatewayKey) + "_refererAddress") |
---|
56 | 56 | | if ((tryGetString(refStateKey) == "")) |
---|
57 | | - | then [StringEntry(refStateKey, refererAddress), StringEntry(((("address_" + refererAddress) + "_refererKey_") + refererKey), refererKey)] |
---|
58 | | - | else throw((("The ref key \"" + refererKey) + "\" is already registered")) |
---|
| 57 | + | then [StringEntry(refStateKey, gatewayAddress), StringEntry(((("address_" + gatewayAddress) + "_refererKey_") + gatewayKey), gatewayKey)] |
---|
| 58 | + | else throw((("The ref key \"" + gatewayKey) + "\" is already registered")) |
---|
59 | 59 | | } |
---|
60 | 60 | | |
---|
61 | 61 | | |
---|
62 | 62 | | |
---|
63 | 63 | | @Callable(i) |
---|
64 | | - | func refPayment (refererKey) = { |
---|
| 64 | + | func gatewayreward (refererKey) = { |
---|
65 | 65 | | let referalAddress = toString(i.originCaller) |
---|
66 | 66 | | if (if ((i.caller.bytes != incubatorAddress)) |
---|
67 | | - | then (i.caller.bytes != farmingAddress) |
---|
| 67 | + | then (i.caller.bytes != userAddress) |
---|
68 | 68 | | else false) |
---|
69 | 69 | | then throw("This method can be called only by farming and incubator dApps") |
---|
70 | 70 | | else if (if ((refererKey == "")) |
---|
71 | 71 | | then (tryGetString((("address_" + referalAddress) + "_referedBy")) == "") |
---|
72 | 72 | | else false) |
---|
73 | 73 | | then nil |
---|
74 | | - | else if (masterTryGetBoolean(("farm_" + referalAddress))) |
---|
| 74 | + | else if (masterTryGetBoolean(("gateway_" + referalAddress))) |
---|
75 | 75 | | then nil |
---|
76 | 76 | | else { |
---|
77 | 77 | | let givenReferer = match getString(this, (("key_" + refererKey) + "_refererAddress")) { |
---|
78 | 78 | | case x: String => |
---|
79 | 79 | | x |
---|
80 | 80 | | case _ => |
---|
81 | 81 | | refererKey |
---|
82 | 82 | | } |
---|
83 | 83 | | let refererAddress = match getString(this, (("address_" + referalAddress) + "_referedBy")) { |
---|
84 | 84 | | case x: String => |
---|
85 | 85 | | x |
---|
86 | 86 | | case _ => |
---|
87 | 87 | | givenReferer |
---|
88 | 88 | | } |
---|
89 | 89 | | let refAmount = (i.payments[0].amount * getRefMultiplier(refererAddress)) |
---|
90 | 90 | | if ((addressFromString(refererAddress) == unit)) |
---|
91 | 91 | | then nil |
---|
92 | 92 | | else { |
---|
93 | 93 | | let refererAddressValue = addressFromStringValue(refererAddress) |
---|
94 | 94 | | let referalAddressValue = addressFromStringValue(referalAddress) |
---|
95 | 95 | | let paymentForReferer = refAmount |
---|
96 | 96 | | let refererEarnedReward = (("address_" + refererAddress) + "_earnedReward") |
---|
97 | 97 | | let referalDeliveredReward = (((("referer_" + refererAddress) + "_referal_") + referalAddress) + "_deliveredReward") |
---|
98 | 98 | | if ((refererAddress == referalAddress)) |
---|
99 | 99 | | then nil |
---|
100 | | - | else [StringEntry((("address_" + referalAddress) + "_referedBy"), refererAddress), IntegerEntry(refererEarnedReward, (tryGetInteger(refererEarnedReward) + paymentForReferer)), IntegerEntry(referalDeliveredReward, (tryGetInteger(referalDeliveredReward) + paymentForReferer)), IntegerEntry((((("referer_" + refererAddress) + "_referal_") + referalAddress) + "_amount"), (tryGetInteger((((("referer_" + refererAddress) + "_referal_") + referalAddress) + "_amount")) + 1)), ScriptTransfer(refererAddressValue, paymentForReferer, eggsAssetId)] |
---|
| 100 | + | else [StringEntry((("address_" + referalAddress) + "_referedBy"), refererAddress), IntegerEntry(refererEarnedReward, (tryGetInteger(refererEarnedReward) + paymentForReferer)), IntegerEntry(referalDeliveredReward, (tryGetInteger(referalDeliveredReward) + paymentForReferer)), IntegerEntry((((("referer_" + refererAddress) + "_referal_") + referalAddress) + "_amount"), (tryGetInteger((((("referer_" + refererAddress) + "_referal_") + referalAddress) + "_amount")) + 1)), ScriptTransfer(refererAddressValue, paymentForReferer, userAddress)] |
---|
101 | 101 | | } |
---|
102 | 102 | | } |
---|
103 | 103 | | } |
---|
104 | 104 | | |
---|
105 | 105 | | |
---|
106 | 106 | | @Verifier(tx) |
---|
107 | 107 | | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) |
---|
108 | 108 | | |
---|