tx · F2S5DF14n1doMQG9WN1ruguTjwy279JMja8AhQRLKzXh

3Mx9tTPu2MYwjhEBmxNxnvAZgpdDLyuJDG5:  -0.01000000 Waves

2021.04.01 16:58 [1463464] smart account 3Mx9tTPu2MYwjhEBmxNxnvAZgpdDLyuJDG5 > SELF 0.00000000 Waves

{ "type": 13, "id": "F2S5DF14n1doMQG9WN1ruguTjwy279JMja8AhQRLKzXh", "fee": 1000000, "feeAssetId": null, "timestamp": 1617285581335, "version": 2, "chainId": 84, "sender": "3Mx9tTPu2MYwjhEBmxNxnvAZgpdDLyuJDG5", "senderPublicKey": "E4t2cV8kyrbyNPfQejyfZZzQCmatPFz8WfWPL73oR35k", "proofs": [ "2ZWYJo9iq4L9iSSH9nZmrkh3LdLLg8Qy999p1FJXeZghhspSmkRrLhi14qaUy6PYez1Y3zDqpDqKH9Gmvwi21ETV" ], "script": "base64:AAIEAAAAAAAAACAIAhIECgIIARIDCgEBEgQKAggBEgQKAggBEgUKAwgIAQAAAAgAAAAACG93bmVyS2V5AgAAAAJfbwAAAAAKYmFsYW5jZUtleQIAAAACX2IAAAAAC2FwcHJvdmFsS2V5AgAAAAJfYQAAAAATb3BlcmF0b3JBcHByb3ZhbEtleQIAAAADX29hAQAAAA5jaGVja0V4aXN0ZW5jZQAAAAEAAAAHdG9rZW5JZAQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzCQABLAAAAAIJAAGkAAAAAQUAAAAHdG9rZW5JZAUAAAAIb3duZXJLZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAYHAQAAAApnZXRCYWxhbmNlAAAAAQAAAAdhY2NvdW50BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMJAAEsAAAAAgUAAAAHYWNjb3VudAUAAAAKYmFsYW5jZUtleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAA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AAAAAAABCQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAIJAAEsAAAAAgkAAaQAAAABBQAAAAd0b2tlbklkBQAAAAhvd25lcktleQUAAAACdG8FAAAAA25pbAAAAADtdR7V", "height": 1463464, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 4 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let ownerKey = "_o"
5+
6+let balanceKey = "_b"
7+
8+let approvalKey = "_a"
9+
10+let operatorApprovalKey = "_oa"
11+
12+func checkExistence (tokenId) = match getString(this, (toString(tokenId) + ownerKey)) {
13+ case a: String =>
14+ true
15+ case _ =>
16+ false
17+}
18+
19+
20+func getBalance (account) = match getInteger(this, (account + balanceKey)) {
21+ case a: Int =>
22+ a
23+ case _ =>
24+ 0
25+}
26+
27+
28+func getApproval (tokenId) = match getString(this, (toString(tokenId) + approvalKey)) {
29+ case a: String =>
30+ a
31+ case _ =>
32+ ""
33+}
34+
35+
36+func getOwner (tokenId) = match getString(this, (toString(tokenId) + ownerKey)) {
37+ case o: String =>
38+ o
39+ case _ =>
40+ ""
41+}
42+
43+
44+@Callable(i)
45+func mint (account,tokenId) = {
46+ let currentBalance = getBalance(account)
47+ let address = match addressFromString(account) {
48+ case a: Address =>
49+ toString(a)
50+ case _ =>
51+ throw("Invalid address")
52+ }
53+ let exists = checkExistence(tokenId)
54+ if (exists)
55+ then throw("Token already minted")
56+ else [IntegerEntry((account + balanceKey), (currentBalance + 1)), StringEntry((toString(tokenId) + ownerKey), address)]
57+ }
58+
59+
60+
61+@Callable(i)
62+func burn (tokenId) = {
63+ let exists = checkExistence(tokenId)
64+ if (!(exists))
65+ then throw("Token doesn't exist")
66+ else {
67+ let owner = getOwner(tokenId)
68+ let currentBalance = getBalance(owner)
69+[IntegerEntry((owner + balanceKey), (currentBalance - 1)), DeleteEntry((toString(tokenId) + approvalKey)), DeleteEntry((toString(tokenId) + ownerKey))]
70+ }
71+ }
72+
73+
74+
75+@Callable(i)
76+func approve (to,tokenId) = {
77+ let caller = toString(addressFromPublicKey(i.callerPublicKey))
78+ let owner = getOwner(tokenId)
79+ if ((owner != caller))
80+ then throw("Approve caller is not owner")
81+ else [StringEntry((toString(tokenId) + approvalKey), to)]
82+ }
83+
84+
85+
86+@Callable(i)
87+func transfer (address,tokenId) = {
88+ let from = toString(addressFromPublicKey(i.callerPublicKey))
89+ let owner = getOwner(tokenId)
90+ if ((owner != from))
91+ then throw("Transfer caller is not owner")
92+ else {
93+ let to = match addressFromString(address) {
94+ case a: Address =>
95+ toString(a)
96+ case _ =>
97+ throw("Invalid address")
98+ }
99+ let currentBalanceFrom = getBalance(from)
100+ let currentBalanceTo = getBalance(to)
101+[DeleteEntry((toString(tokenId) + approvalKey)), IntegerEntry((from + balanceKey), (currentBalanceFrom - 1)), IntegerEntry((to + balanceKey), (currentBalanceTo + 1)), StringEntry((toString(tokenId) + ownerKey), to)]
102+ }
103+ }
104+
105+
106+
107+@Callable(i)
108+func transferFrom (from,to,tokenId) = {
109+ let owner = getOwner(tokenId)
110+ if ((owner != from))
111+ then throw("Transfer caller is not owner")
112+ else {
113+ let approval = getApproval(tokenId)
114+ if ((approval != to))
115+ then throw("Transfer caller is not owner")
116+ else {
117+ let address = match addressFromString(to) {
118+ case a: Address =>
119+ toString(a)
120+ case _ =>
121+ throw("Invalid address")
122+ }
123+ let currentBalanceFrom = getBalance(from)
124+ let currentBalanceTo = getBalance(address)
125+[DeleteEntry((toString(tokenId) + approvalKey)), IntegerEntry((from + balanceKey), (currentBalanceFrom - 1)), IntegerEntry((address + balanceKey), (currentBalanceTo + 1)), StringEntry((toString(tokenId) + ownerKey), to)]
126+ }
127+ }
128+ }
129+
130+

github/deemru/w8io/026f985 
22.61 ms