tx · BAdaQGgqqyGcP16g8okMXKSeEMgLd7ktKQri45EKjzQF

3NA73oUXjqp7SpudXWV1yMFuKm9awPbqsVz:  -0.00600000 Waves

2022.10.04 14:05 [2257508] smart account 3NA73oUXjqp7SpudXWV1yMFuKm9awPbqsVz > SELF 0.00000000 Waves

{ "type": 13, "id": "BAdaQGgqqyGcP16g8okMXKSeEMgLd7ktKQri45EKjzQF", "fee": 600000, "feeAssetId": null, "timestamp": 1664881605465, "version": 2, "chainId": 84, "sender": "3NA73oUXjqp7SpudXWV1yMFuKm9awPbqsVz", "senderPublicKey": "2mHW72YTfnxJ1M8WsdUQjgpp3a2SUbt9mbAiePGiuJok", "proofs": [ "4pZ8ZkUNDPhF9YJVjjFAGtTwQcQny7tBBChBvt7fPRW58QAtzksAd6GSnEajQvkpwF2jdwHUJquw67arJXy6HEFr" ], "script": "base64:AAIFAAAAAAAAABIIAhIECgIIARIDCgEIEgMKAQgAAAAVAQAAABBnZXRTdHJpbmdPclRocm93AAAAAgAAAAdhZGRyZXNzAAAAA2tleQkBAAAAE3ZhbHVlT3JFcnJvck1lc3NhZ2UAAAACCQAEHQAAAAIFAAAAB2FkZHJlc3MFAAAAA2tleQkAASwAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAMQ2FuJ3QgcmVhZCAnBQAAAANrZXkCAAAADScgYXQgYWRkcmVzcyAJAAQlAAAAAQUAAAAHYWRkcmVzcwEAAAARZ2V0SW50ZWdlck9yVGhyb3cAAAACAAAAB2FkZHJlc3MAAAADa2V5CQEAAAATdmFsdWVPckVycm9yTWVzc2FnZQAAAAIJAAQaAAAAAgUAAAAHYWRkcmVzcwUAAAADa2V5CQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAAAxDYW4ndCByZWFkICcFAAAAA2tleQIAAAANJyBhdCBhZGRyZXNzIAkABCUAAAABBQAAAAdhZGRyZXNzAQAAABNwYXJzZUFkZHJlc3NPclRocm93AAAAAQAAAAxtYXliZUFkZHJlc3MJAQAAABN2YW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AAAZjYWxsZXIFAAAAB3Rva2VuSWQAAAAAAAAAAAAJAAACAAAAAQIAAAAcWW91IGRvbid0IGhhdmUgYSBuYW1lZCB0b2tlbgkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQEAAAAOa2V5X05hbWVfb3duZXIAAAABBQAAAARuYW1lBQAAAAljYWxsZXJTdHIFAAAAA25pbAAAAABzKXu6", "height": 2257508, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BjiEgx7v1bhLqrqYGr3brGLg5w2yUMxdbvMWZzd6oj9C Next: HQYBkyEqFZN1MiNtUSCBVABXcKbWb72DPAzms2rhDE8z Diff:
OldNewDifferences
6161
6262 func isExpiredName (name) = match getInteger(this, key_Name_expiresAt(name)) {
6363 case expiresAt: Int =>
64- (expiresAt > lastBlock.timestamp)
64+ (lastBlock.timestamp > expiresAt)
6565 case _ =>
6666 false
6767 }
7878 func registerOwnership (name) = {
7979 let caller = inv.caller
8080 let callerStr = toString(caller)
81- let $t028233071 = match invoke(auction, "getWinnerInfo", [name], nil) {
81+ let $t028233081 = match invoke(auction, "getWinnerInfo", [name], nil) {
8282 case winnerInfo: (Int, String, String) =>
8383 winnerInfo
8484 case _ =>
85- throw("Unexpected getWinnerInfo result")
85+ throw("Unsupported result format (getWinnerInfo)")
8686 }
87- let winnerAuctionId = $t028233071._1
88- let winnerAddress = $t028233071._2
89- let winnerHash = $t028233071._3
87+ let winnerAuctionId = $t028233081._1
88+ let winnerAddress = $t028233081._2
89+ let winnerHash = $t028233081._3
9090 let auctionEnd = match invoke(auction, "getAuctionById", [winnerAuctionId], nil) {
9191 case info: (Int, String, Int, Int, Int) =>
9292 info._5
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 func getStringOrThrow (address,key) = valueOrErrorMessage(getString(address, key), ((("Can't read '" + key) + "' at address ") + toString(address)))
55
66
77 func getIntegerOrThrow (address,key) = valueOrErrorMessage(getInteger(address, key), ((("Can't read '" + key) + "' at address ") + toString(address)))
88
99
1010 func parseAddressOrThrow (maybeAddress) = valueOrErrorMessage(addressFromString(maybeAddress), (("Can't parse address from '" + maybeAddress) + "'"))
1111
1212
1313 func key_entity (name,pk,property) = ((((name + "_") + pk) + "_") + property)
1414
1515
1616 func key_Token_name (tokenId) = key_entity("Token", tokenId, "name")
1717
1818
1919 func key_Name_token (name) = key_entity("Name", name, "token")
2020
2121
2222 func key_Name_owner (name) = key_entity("Name", name, "owner")
2323
2424
2525 func key_Name_expiresAt (name) = key_entity("Name", name, "expiresAt")
2626
2727
2828 func key_Name_createdAt (name) = key_entity("Name", name, "createdAt")
2929
3030
3131 func key_Owner_name (address) = key_entity("Owner", address, "name")
3232
3333
3434 let key_auctionAddress = "auctionAddress"
3535
3636 let key_nameExpirationInterval = "nameExpirationInterval"
3737
3838 let key_maxAuthorizedFee = "maxAuthorizedFee"
3939
4040 let auctionAddress = getStringOrThrow(this, key_auctionAddress)
4141
4242 let auction = parseAddressOrThrow(auctionAddress)
4343
4444 let nameExpirationInterval = getIntegerOrThrow(this, key_nameExpirationInterval)
4545
4646 let maxAuthorizedFee = getIntegerOrThrow(this, key_maxAuthorizedFee)
4747
4848 func whoIs (name) = {
4949 let expiresAt = getIntegerOrThrow(this, key_Name_expiresAt(name))
5050 let token = getStringOrThrow(this, key_Name_token(name))
5151 let owner = getStringOrThrow(this, key_Name_owner(name))
5252 $Tuple3(owner, expiresAt, token)
5353 }
5454
5555
5656 func isRegisteredToken (tokenId) = isDefined(getString(this, key_Token_name(tokenId)))
5757
5858
5959 func isRegisteredName (name) = isDefined(getString(this, key_Name_token(name)))
6060
6161
6262 func isExpiredName (name) = match getInteger(this, key_Name_expiresAt(name)) {
6363 case expiresAt: Int =>
64- (expiresAt > lastBlock.timestamp)
64+ (lastBlock.timestamp > expiresAt)
6565 case _ =>
6666 false
6767 }
6868
6969
7070 @Callable(inv)
7171 func init (auctionAddress,nameExpirationInterval) = if ((inv.caller != this))
7272 then throw("Permission denied")
7373 else [StringEntry(key_auctionAddress, auctionAddress), IntegerEntry(key_nameExpirationInterval, nameExpirationInterval)]
7474
7575
7676
7777 @Callable(inv)
7878 func registerOwnership (name) = {
7979 let caller = inv.caller
8080 let callerStr = toString(caller)
81- let $t028233071 = match invoke(auction, "getWinnerInfo", [name], nil) {
81+ let $t028233081 = match invoke(auction, "getWinnerInfo", [name], nil) {
8282 case winnerInfo: (Int, String, String) =>
8383 winnerInfo
8484 case _ =>
85- throw("Unexpected getWinnerInfo result")
85+ throw("Unsupported result format (getWinnerInfo)")
8686 }
87- let winnerAuctionId = $t028233071._1
88- let winnerAddress = $t028233071._2
89- let winnerHash = $t028233071._3
87+ let winnerAuctionId = $t028233081._1
88+ let winnerAddress = $t028233081._2
89+ let winnerHash = $t028233081._3
9090 let auctionEnd = match invoke(auction, "getAuctionById", [winnerAuctionId], nil) {
9191 case info: (Int, String, Int, Int, Int) =>
9292 info._5
9393 case _ =>
9494 throw("Unsupported result format (getAuctionById)")
9595 }
9696 if ((callerStr != winnerAddress))
9797 then throw(((("Winner address " + winnerAddress) + "doesn't match with caller address") + callerStr))
9898 else if (if (isRegisteredName(name))
9999 then !(isExpiredName(name))
100100 else false)
101101 then throw("Name already in use")
102102 else {
103103 let issueNameToken = Issue(if ((size(name) > 16))
104104 then (take(name, 15) + "~")
105105 else take(name, 16), name, 1, 0, false)
106106 let tokenId = calculateAssetId(issueNameToken)
107107 let tokenStr = toBase58String(tokenId)
108108 let issueAndRegister = [issueNameToken, StringEntry(key_Name_token(name), tokenStr), StringEntry(key_Token_name(tokenStr), name), IntegerEntry(key_Name_createdAt(name), auctionEnd), IntegerEntry(key_Name_expiresAt(name), (auctionEnd + nameExpirationInterval))]
109109 let setOwnershipAndTransfer = [StringEntry(key_Name_owner(name), callerStr), ScriptTransfer(caller, 1, tokenId)]
110110 (issueAndRegister ++ setOwnershipAndTransfer)
111111 }
112112 }
113113
114114
115115
116116 @Callable(inv)
117117 func approveOwnership (name) = {
118118 let caller = inv.caller
119119 let callerStr = toString(caller)
120120 let owner = valueOrErrorMessage(getString(this, key_Name_owner(name)), "Owner is not defined")
121121 let tokenStr = valueOrErrorMessage(getString(this, key_Name_token(name)), "No token is issued for this name")
122122 let tokenId = fromBase58String(tokenStr)
123123 let token = match assetInfo(tokenId) {
124124 case a: Asset =>
125125 a
126126 case _ =>
127127 throw("Can't find asset")
128128 }
129129 if ((callerStr == owner))
130130 then throw("You already own this name")
131131 else if (!(isRegisteredName(name)))
132132 then throw("Name is not registered")
133133 else if (isExpiredName(name))
134134 then throw("The period of ownership has expired")
135135 else if ((assetBalance(caller, tokenId) == 0))
136136 then throw("You don't have a named token")
137137 else [StringEntry(key_Name_owner(name), callerStr)]
138138 }
139139
140140

github/deemru/w8io/873ac7e 
44.64 ms