tx · DKJFWnG6gGZH7DZMP1HtzLLWat5KG1Y64RV7kNRARc2V 3MsX9C2MzzxE4ySF5aYcJoaiPfkyxZMg4cW: -0.00700000 Waves 2022.06.16 13:06 [2098787] smart account 3MsX9C2MzzxE4ySF5aYcJoaiPfkyxZMg4cW > SELF 0.00000000 Waves
{ "type": 13, "id": "DKJFWnG6gGZH7DZMP1HtzLLWat5KG1Y64RV7kNRARc2V", "fee": 700000, "feeAssetId": null, "timestamp": 1655374006569, "version": 2, "chainId": 84, "sender": "3MsX9C2MzzxE4ySF5aYcJoaiPfkyxZMg4cW", "senderPublicKey": "AXbaBkJNocyrVpwqTzD4TpUY8fQ6eeRto9k1m2bNCzXV", "proofs": [ "PdeuMKVYzHBv4oZX9e4PCX2wo2L4TCe4NvfXX2cUX2xWU2xWVLW8AVBEoFAY1S8GhZWXBcrYTJyoPGWpALDX8Ls" ], "script": "base64:AAIFAAAAAAAAAAgIAhIAEgASAAAAAAYAAAAACXRva2VuTmFtZQIAAAAJdG9rZW5OYW1lAAAAABB0b3RhbEZvdW5kZXJzS2V5AgAAAA50b3RhbFdoaXRlTGlzdAAAAAAQbWluRm91bmRlcnNDb3VudAAAAAAAAAAABQAAAAAMcGF5bWVudEFtb250AAAAAAAAHoSAAQAAAA9nZXRXaGl0ZUxpc3RLZXkAAAABAAAABGFkZHIEAAAACXNlcGFyYXRvcgIAAAABXwQAAAAGcHJlZml4AgAAAAJ3bAkABLkAAAACCQAETAAAAAIFAAAABnByZWZpeAkABEwAAAACCQAEJQAAAAEFAAAABGFkZHIFAAAAA25pbAUAAAAJc2VwYXJhdG9yAQAAAAxjaGVja1BheW1lbnQAAAABAAAAAWkDCQEAAAACIT0AAAACCQABkAAAAAEIBQAAAAFpAAAACHBheW1lbnRzAAAAAAAAAAABBwQAAAABcAkAAZEAAAACCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAAQAAAAHJG1hdGNoMAgFAAAAAXAAAAAHYXNzZXRJZAMJAAABAAAAAgUA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WJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABdNYXNzVHJhbnNmZXJUcmFuc2FjdGlvbgQAAAADbXR0BQAAAAckbWF0Y2gwCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAPRGF0YVRyYW5zYWN0aW9uBAAAAAJkdAUAAAAHJG1hdGNoMAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAF0ludm9rZVNjcmlwdFRyYW5zYWN0aW9uBAAAAAJpdAUAAAAHJG1hdGNoMAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXkHCaLyCA==", "height": 2098787, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: F4qr6mi4fT4LsQjPsogUX4FoYobARwT8iT2WQ1eLQiqe Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let | |
4 | + | let tokenName = "tokenName" | |
5 | 5 | ||
6 | - | let | |
6 | + | let totalFoundersKey = "totalWhiteList" | |
7 | 7 | ||
8 | - | let | |
8 | + | let minFoundersCount = 5 | |
9 | 9 | ||
10 | - | let | |
10 | + | let paymentAmont = 2000000 | |
11 | 11 | ||
12 | - | func coordsToIndex (x,y) = ((x * COLS) + y) | |
12 | + | func getWhiteListKey (addr) = { | |
13 | + | let separator = "_" | |
14 | + | let prefix = "wl" | |
15 | + | makeString([prefix, toString(addr)], separator) | |
16 | + | } | |
17 | + | ||
18 | + | ||
19 | + | func checkPayment (i) = if ((size(i.payments) != 1)) | |
20 | + | then false | |
21 | + | else { | |
22 | + | let p = i.payments[0] | |
23 | + | match p.assetId { | |
24 | + | case u: Unit => | |
25 | + | (p.amount >= paymentAmont) | |
26 | + | case a: ByteVector => | |
27 | + | false | |
28 | + | case _ => | |
29 | + | throw("Match error") | |
30 | + | } | |
31 | + | } | |
13 | 32 | ||
14 | 33 | ||
15 | 34 | @Callable(i) | |
16 | - | func purchase (x,y) = { | |
17 | - | let assetName = ((x + ", ") + y) | |
18 | - | let assetUrl = ((nftDomain + toBase58String(i.transactionId)) + ".png") | |
19 | - | let asset = Issue((assetName + " Gen 1"), assetUrl, 1, 0, false) | |
20 | - | let assetId = calculateAssetId(asset) | |
21 | - | let gen = "01" | |
22 | - | let dataKeyPrefix = ((assetName + ",") + gen) | |
23 | - | [asset, StringEntry(dataKeyPrefix, toBase58String(assetId)), StringEntry((dataKeyPrefix + "_asset"), assetUrl), StringEntry((dataKeyPrefix + "_owner"), toBase58String(i.caller.bytes)), ScriptTransfer(i.caller, 1, assetId)] | |
35 | + | func register () = { | |
36 | + | let paymentValidation = checkPayment(i) | |
37 | + | if (paymentValidation) | |
38 | + | then { | |
39 | + | let key = getWhiteListKey(i.caller) | |
40 | + | let slot = getBoolean(this, key) | |
41 | + | if (isDefined(slot)) | |
42 | + | then throw("reg only once") | |
43 | + | else { | |
44 | + | let total = valueOrElse(getInteger(this, totalFoundersKey), 0) | |
45 | + | [BooleanEntry(key, true), IntegerEntry(totalFoundersKey, (total + 1))] | |
46 | + | } | |
47 | + | } | |
48 | + | else throw(("You should attach one payment in WAWES=" + toString(paymentAmont))) | |
49 | + | } | |
50 | + | ||
51 | + | ||
52 | + | ||
53 | + | @Callable(i) | |
54 | + | func start () = if ((i.caller != this)) | |
55 | + | then throw("admin only") | |
56 | + | else { | |
57 | + | let total = valueOrElse(getInteger(this, totalFoundersKey), 0) | |
58 | + | if ((total >= minFoundersCount)) | |
59 | + | then { | |
60 | + | let newToken = Issue(tokenName, "", 1000000000, 0, true) | |
61 | + | let issueId = calculateAssetId(newToken) | |
62 | + | [newToken, BinaryEntry(tokenName, issueId)] | |
63 | + | } | |
64 | + | else throw("need more founders") | |
65 | + | } | |
66 | + | ||
67 | + | ||
68 | + | ||
69 | + | @Callable(i) | |
70 | + | func getTokens () = { | |
71 | + | let userKey = getWhiteListKey(i.caller) | |
72 | + | let slot = valueOrElse(getBoolean(this, userKey), false) | |
73 | + | let tokenId = getBinary(this, tokenName) | |
74 | + | if ((tokenId == unit)) | |
75 | + | then throw("wait for start") | |
76 | + | else if (slot) | |
77 | + | then [ScriptTransfer(i.caller, 1000, tokenId), BooleanEntry(userKey, false)] | |
78 | + | else throw("get only once") | |
24 | 79 | } | |
25 | 80 | ||
26 | 81 | ||
27 | 82 | @Verifier(tx) | |
28 | - | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
83 | + | func verify () = match tx { | |
84 | + | case tt: TransferTransaction => | |
85 | + | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
86 | + | case mtt: MassTransferTransaction => | |
87 | + | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
88 | + | case dt: DataTransaction => | |
89 | + | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
90 | + | case it: InvokeScriptTransaction => | |
91 | + | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
92 | + | case _ => | |
93 | + | false | |
94 | + | } | |
29 | 95 |
github/deemru/w8io/026f985 62.60 ms ◑