tx · DMC6hoZKRKR58wnA6EnRcDCpfAh8reFTn8WTiY5TfXeA

3N9XUY4TCK9rbrnuuHhniWgzZvTWEDQbz3m:  -0.01000000 Waves

2021.07.24 16:01 [1627751] smart account 3N9XUY4TCK9rbrnuuHhniWgzZvTWEDQbz3m > SELF 0.00000000 Waves

{ "type": 13, "id": "DMC6hoZKRKR58wnA6EnRcDCpfAh8reFTn8WTiY5TfXeA", "fee": 1000000, "feeAssetId": null, "timestamp": 1627131698158, "version": 2, "chainId": 84, "sender": "3N9XUY4TCK9rbrnuuHhniWgzZvTWEDQbz3m", "senderPublicKey": "5T2aguuLUCnpqZJCfGMszGbxDZmzchjmTERevjCdiMyr", "proofs": [ "5CQu7PXo8HustapkWCPfU56mi8RYbWzxPRzShytDiWSyVPbjwD9UFa8W9oW8La1t1g4qQmiHmfYtxWHvX6NEvrMb" ], "script": "base64:AAIFAAAAAAAAApsIAhIDCgEIEgMKAQgaHAoCYTESFmZhY3RvcnlDb250cmFjdEFkZHJlc3MaIwoCYTISHXByb2ZpbGVzT3JhY2xlQ29udHJhY3RBZGRyZXNzGhYKAmEzEhBnaXZlU3RhdGVQZW5kaW5nGhQKAmE0Eg5naXZlU3RhdGVUYWtlZBoTCgJhNRINZGF0YVNlcGFyYXRvchoXCgJhNhIRZ2V0TGFzdEdpdmVJZHhLZXkaCgoCYTcSBGFkZHIaFAoCYTgSDmdldExhc3RHaXZlSWR4Gg0KAmE5EgckbWF0Y2gwGgcKAmIxEgFpGhMKAmIyEg1nZXROZXdHaXZlSWR4Gg8KAmIzEglnZXRHaXZlSWQaCQoCYjQSA2lkeBoVCgJiNRIPZ2V0R2l2ZVN0YXRlS2V5GgwKAmI2EgZnaXZlSWQaFAoCYjcSDmdldEdpdmVEYXRhS2V5GhsKAmI4EhVnZW5lcmF0ZUdpdmVEYXRhVmFsdWUaDwoCYjkSCWhhc2hlZFVyaRoRCgJjMRILYml0b2dyYXBoSWQaGAoCYzISEnBhcnNlR2l2ZURhdGFWYW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JkNAkBAAAAAmI4AAAAAgUAAAACYjkFAAAAAmMxBQAAAANuaWwAAAACYjEBAAAACHRha2VHaXZlAAAAAQAAAAJiNgQAAAACZDUJAQAAAAJjNAAAAAEFAAAAAmI2BAAAAAJkNgQAAAACYTkJAAQdAAAAAgkBAAAAB0FkZHJlc3MAAAABBQAAAAJhMgkAAZEAAAACBQAAAAJkNQAAAAAAAAAAAAMJAAABAAAAAgUAAAACYTkCAAAABlN0cmluZwQAAAACYTcFAAAAAmE5CQEAAAAHQWRkcmVzcwAAAAEJAAJZAAAAAQUAAAACYTcJAAACAAAAAQIAAAAuUmVjaXBpZW50IG9mIHNwZWNpZmllZCBnaXZlIGRvZXMgbm90IGV4aXN0IHlldAMJAQAAAAIhPQAAAAIFAAAAAmQ2CAUAAAACYjEAAAAGY2FsbGVyCQAAAgAAAAECAAAAHFlvdSBjYW5ub3QgdGFrZSBmb3JlaWduIGdpdmUEAAAAAmMxCQACWQAAAAEJAAGRAAAAAgUAAAACZDUAAAAAAAAAAAEJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkBAAAAAmI1AAAAAQUAAAACYjYFAAAAAmE0CQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAAAmQ2AAAAAAAAAAABBQAAAAJjMQUAAAADbmlsAAAAAQAAAAJkNwEAAAACZDgAAAAACQAB9AAAAAMIBQAAAAJkNwAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAmQ3AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAmQ3AAAAD3NlbmRlclB1YmxpY0tleVsoFkg=", "height": 1627751, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 5 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let factoryContractAddress = base58'3N4v4VAHbK5das4wB5QGripYbQFJ3PaB75e'
5+
6+let profilesOracleContractAddress = base58'3MsKhh2tBJqUdyNakXBjdq3vL7uR5Yrz6Dc'
7+
8+let giveStatePending = "PENDING"
9+
10+let giveStateTaked = "TAKED"
11+
12+let dataSeparator = "__"
13+
14+func getLastGiveIdxKey (addr) = (toString(addr) + ":last_give_idx")
15+
16+
17+func getLastGiveIdx (addr) = match getInteger(this, getLastGiveIdxKey(addr)) {
18+ case i: Int =>
19+ i
20+ case _ =>
21+ 1
22+}
23+
24+
25+func getNewGiveIdx (addr) = (getLastGiveIdx(addr) + 1)
26+
27+
28+func getGiveId (addr,idx) = ((toString(addr) + ":") + toString(idx))
29+
30+
31+func getGiveStateKey (giveId) = (("give:" + giveId) + ":state")
32+
33+
34+func getGiveDataKey (giveId) = (("give:" + giveId) + ":data")
35+
36+
37+func generateGiveDataValue (hashedUri,bitographId) = ((hashedUri + dataSeparator) + toBase58String(bitographId))
38+
39+
40+func parseGiveDataValue (value) = split(value, dataSeparator)
41+
42+
43+func getGiveData (giveId) = {
44+ let giveState = match getString(this, getGiveStateKey(giveId)) {
45+ case state: String =>
46+ state
47+ case _ =>
48+ throw("Give with specified id does not exist")
49+ }
50+ if ((giveState != giveStatePending))
51+ then throw("Give is not in pending state")
52+ else {
53+ let giveDataRaw = getStringValue(this, getGiveDataKey(giveId))
54+ parseGiveDataValue(giveDataRaw)
55+ }
56+ }
57+
58+
59+func isNFT (asset) = if (if ((asset.decimals == 0))
60+ then true
61+ else (asset.quantity == 1))
62+ then true
63+ else !(asset.reissuable)
64+
65+
66+@Callable(i)
67+func createGive (hashedUri) = if ((1 > size(i.payments)))
68+ then throw("Bitograph have to be send as payment for tx")
69+ else {
70+ let bitographId = match i.payments[0].assetId {
71+ case _: Unit =>
72+ throw("Specified payment is not a valid bitograph")
73+ case assetId: ByteVector =>
74+ assetId
75+ case _ =>
76+ throw("Match error")
77+ }
78+ if ((1 > i.payments[0].amount))
79+ then throw("You have to send at least one bitograph for give creating")
80+ else {
81+ let bitograph = match assetInfo(bitographId) {
82+ case _: Unit =>
83+ throw("Specified payment is not a valid bitograph")
84+ case asset: Asset =>
85+ asset
86+ case _ =>
87+ throw("Match error")
88+ }
89+ if (if ((bitograph.issuer != Address(factoryContractAddress)))
90+ then true
91+ else !(isNFT(bitograph)))
92+ then throw("Specified asset is not a valid bitograph")
93+ else {
94+ let newGiveIdx = getNewGiveIdx(i.caller)
95+ let newGiveId = getGiveId(i.caller, newGiveIdx)
96+[IntegerEntry(getLastGiveIdxKey(i.caller), newGiveIdx), StringEntry(getGiveStateKey(newGiveId), giveStatePending), StringEntry(getGiveDataKey(newGiveId), generateGiveDataValue(hashedUri, bitographId))]
97+ }
98+ }
99+ }
100+
101+
102+
103+@Callable(i)
104+func takeGive (giveId) = {
105+ let giveData = getGiveData(giveId)
106+ let giveRecipientAddr = match getString(Address(profilesOracleContractAddress), giveData[0]) {
107+ case addr: String =>
108+ Address(fromBase58String(addr))
109+ case _ =>
110+ throw("Recipient of specified give does not exist yet")
111+ }
112+ if ((giveRecipientAddr != i.caller))
113+ then throw("You cannot take foreign give")
114+ else {
115+ let bitographId = fromBase58String(giveData[1])
116+[StringEntry(getGiveStateKey(giveId), giveStateTaked), ScriptTransfer(giveRecipientAddr, 1, bitographId)]
117+ }
118+ }
119+
120+
121+@Verifier(tx)
122+func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
123+

github/deemru/w8io/026f985 
20.73 ms