tx · 48XVExcKjyEnta9WhvfKiX5RwyyJ583gczQNW2weKXKo

3N9EXJ2Y7szbSfrxUwhWxnL3zK8wf3xosDE:  -0.01400000 Waves

2019.12.17 09:40 [812562] smart account 3N9EXJ2Y7szbSfrxUwhWxnL3zK8wf3xosDE > SELF 0.00000000 Waves

{ "type": 13, "id": "48XVExcKjyEnta9WhvfKiX5RwyyJ583gczQNW2weKXKo", "fee": 1400000, "feeAssetId": null, "timestamp": 1576564840917, "version": 1, "sender": "3N9EXJ2Y7szbSfrxUwhWxnL3zK8wf3xosDE", "senderPublicKey": "9mENuoC82QFsBookiU4McsBPyUkyY7VNWe8nikxj47eh", "proofs": [ "2Th7iBgN3KUVjqfVAaDYodmhyqAQgQ2dd8c3nQ73JAtWF6a2WbNmbuDyp87XpTxAKDdNUrXxRu3d1cAMDYUE69AZ" ], "script": "base64:AAIDAAAAAAAAABIIARIECgIICBIDCgEIEgMKAQgAAAAKAAAAABRkQXBwQWNjb3VudFB1YmxpY0tleQEAAAAggjItYz1wDPYf7XYzYhDTkZ7oouxwtfQFF4TErvLkmhoAAAAACnVzZXJTdWZmaXgCAAAABl9fdXNlcgAAAAAUdW52ZXJpZmllZFVzZXJTdWZmaXgCAAAADF9fdW52ZXJpZmllZAAAAAASdmVyaWZpZWRVc2VyU3VmZml4AgAAAApfX3ZlcmlmaWVkAAAAAAljYXRlZ29yeTECAAAACmFtYmFzc2Fkb3IAAAAACWNhdGVnb3J5MgIAAAASYWN0aXZlIGNvbnRyaWJ1dG9yAAAAAAljYXRlZ29yeTMCAAAAFmNvbW11bml0eSBwYXJ0aWNpcGFudHMBAAAABmlzVXNlcgAAAAEAAAAPY2FsbGVyUHVibGljS2V5BAAAAAd1c2VyS2V5CQABLAAAAAIFAAAAD2NhbGxlclB1YmxpY0tleQUAAAAKdXNlclN1ZmZpeAMJAQAAAAlpc0RlZmluZWQAAAABCQAEHQAAAAIFAAAABHRoaXMFAAAAB3VzZXJLZXkGBwEAAAAPaXNWYWxpZ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dW50UHVibGljS2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABdJbnZva2VTY3JpcHRUcmFuc2FjdGlvbgQAAAABaQUAAAAHJG1hdGNoMAYDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAE1RyYW5zZmVyVHJhbnNhY3Rpb24EAAAAAXQFAAAAByRtYXRjaDAGB4/GIOE=", "chainId": 84, "height": 812562, "spentComplexity": 0 } View: original | compacted Prev: 3fQX1QXWAdfNRcxGufRaDn7nGK61cq1VcyvqW2ahnuoR Next: 4cHqi8C96gnjY5FuhdgUUcCDxKgFBkXAEF1vqLUGq8bd Diff:
OldNewDifferences
99
1010 let verifiedUserSuffix = "__verified"
1111
12+let category1 = "ambassador"
13+
14+let category2 = "active contributor"
15+
16+let category3 = "community participants"
17+
1218 func isUser (callerPublicKey) = {
1319 let userKey = (callerPublicKey + userSuffix)
1420 if (isDefined(getString(this, userKey)))
1521 then true
1622 else false
1723 }
24+
25+
26+func isValidCategory (category) = if (if (if ((category == category1))
27+ then true
28+ else (category == category2))
29+ then true
30+ else (category == category3))
31+ then category
32+ else throw("Category is invalid")
1833
1934
2035 func isVerified (publicKey) = {
3853
3954
4055 @Callable(i)
41-func signUp (info) = {
56+func signUp (info,category) = {
4257 let callerPublicKey = toBase58String(i.callerPublicKey)
4358 if (isUser(callerPublicKey))
4459 then throw("You are already registered")
4560 else {
4661 let currentKey = callerPublicKey
62+ let userCategory = isValidCategory(category)
4763 let currentUserRegistrationValue = (info + unverifiedUserSuffix)
4864 WriteSet([DataEntry((currentKey + userSuffix), currentUserRegistrationValue)])
4965 }
8197 let publicKey = fromBase58String(publicKeyOfUserToTip)
8298 if (isDefined(payment.assetId))
8399 then throw("can hodl waves only at the moment")
84- else if ((publicKey == i.callerPublicKey))
85- then throw("You shouldn't tip yourself")
86- else TransferSet([ScriptTransfer(addressFromPublicKey(publicKey), payment.amount, unit)])
100+ else TransferSet([ScriptTransfer(addressFromPublicKey(publicKey), payment.amount, unit)])
87101 }
88102 else throw("You can't tip this user")
89103
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let dAppAccountPublicKey = base58'9mENuoC82QFsBookiU4McsBPyUkyY7VNWe8nikxj47eh'
55
66 let userSuffix = "__user"
77
88 let unverifiedUserSuffix = "__unverified"
99
1010 let verifiedUserSuffix = "__verified"
1111
12+let category1 = "ambassador"
13+
14+let category2 = "active contributor"
15+
16+let category3 = "community participants"
17+
1218 func isUser (callerPublicKey) = {
1319 let userKey = (callerPublicKey + userSuffix)
1420 if (isDefined(getString(this, userKey)))
1521 then true
1622 else false
1723 }
24+
25+
26+func isValidCategory (category) = if (if (if ((category == category1))
27+ then true
28+ else (category == category2))
29+ then true
30+ else (category == category3))
31+ then category
32+ else throw("Category is invalid")
1833
1934
2035 func isVerified (publicKey) = {
2136 let key = (publicKey + userSuffix)
2237 let userKey = getString(this, key)
2338 if (isDefined(userKey))
2439 then {
2540 let userData = match getString(this, key) {
2641 case a: String =>
2742 a
2843 case _ =>
2944 throw("Record not found")
3045 }
3146 let userList = split(userData, "__")
3247 if ((userList[1] == "verified"))
3348 then true
3449 else false
3550 }
3651 else false
3752 }
3853
3954
4055 @Callable(i)
41-func signUp (info) = {
56+func signUp (info,category) = {
4257 let callerPublicKey = toBase58String(i.callerPublicKey)
4358 if (isUser(callerPublicKey))
4459 then throw("You are already registered")
4560 else {
4661 let currentKey = callerPublicKey
62+ let userCategory = isValidCategory(category)
4763 let currentUserRegistrationValue = (info + unverifiedUserSuffix)
4864 WriteSet([DataEntry((currentKey + userSuffix), currentUserRegistrationValue)])
4965 }
5066 }
5167
5268
5369
5470 @Callable(i)
5571 func verifyUser (publicKey) = if ((i.callerPublicKey != dAppAccountPublicKey))
5672 then throw("Only dApp account can verify a user")
5773 else if (isVerified(publicKey))
5874 then throw("This user has already been verified")
5975 else if (isUser(publicKey))
6076 then {
6177 let userData = match getString(this, (publicKey + userSuffix)) {
6278 case a: String =>
6379 a
6480 case _ =>
6581 throw("User not found")
6682 }
6783 let userList = split(userData, "__")
6884 let userInfo = userList[0]
6985 let updatedUserValue = (userInfo + verifiedUserSuffix)
7086 let userKey = (publicKey + userSuffix)
7187 WriteSet([DataEntry(userKey, updatedUserValue)])
7288 }
7389 else throw("This is not a registered user")
7490
7591
7692
7793 @Callable(i)
7894 func tip (publicKeyOfUserToTip) = if (isVerified(publicKeyOfUserToTip))
7995 then {
8096 let payment = extract(i.payment)
8197 let publicKey = fromBase58String(publicKeyOfUserToTip)
8298 if (isDefined(payment.assetId))
8399 then throw("can hodl waves only at the moment")
84- else if ((publicKey == i.callerPublicKey))
85- then throw("You shouldn't tip yourself")
86- else TransferSet([ScriptTransfer(addressFromPublicKey(publicKey), payment.amount, unit)])
100+ else TransferSet([ScriptTransfer(addressFromPublicKey(publicKey), payment.amount, unit)])
87101 }
88102 else throw("You can't tip this user")
89103
90104
91105 @Verifier(tx)
92106 func verify () = match tx {
93107 case s: SetScriptTransaction =>
94108 sigVerify(tx.bodyBytes, tx.proofs[0], dAppAccountPublicKey)
95109 case i: InvokeScriptTransaction =>
96110 true
97111 case t: TransferTransaction =>
98112 true
99113 case _ =>
100114 false
101115 }
102116

github/deemru/w8io/169f3d6 
47.34 ms