tx · 7t3hKbDaEDscitJVr4p2E8VYHPpHPdBu2XdTzHaHbpfw 3N91zFrRoofbPpkoDbWKrQsQSdLu2EgLL8c: -0.01000000 Waves 2023.10.23 15:48 [2811272] smart account 3N91zFrRoofbPpkoDbWKrQsQSdLu2EgLL8c > SELF 0.00000000 Waves
{ "type": 13, "id": "7t3hKbDaEDscitJVr4p2E8VYHPpHPdBu2XdTzHaHbpfw", "fee": 1000000, "feeAssetId": null, "timestamp": 1698065312393, "version": 2, "chainId": 84, "sender": "3N91zFrRoofbPpkoDbWKrQsQSdLu2EgLL8c", "senderPublicKey": "5FyjUYCR5Q8jvG6ri6Ysz574HerUK6r1LJzzQ7DvSkLk", "proofs": [ "3PoE7kRYzWX16BYuFvokKMWEbC2rTeXpVmYhf4xdz8F7p9NRMv4VoC7CJEddpntMo43DEMjY7VcqDXZfc4dpAsNm" ], "script": "base64:BgIWCAISBgoEAgICARIECgIICBIECgIIAh0ACXNlcGFyYXRvcgICX18AB2NoYWluSWQJAMkBAgkAygECCAUEdGhpcwVieXRlcwABAAEACGNoYWluSWRUAQFUAAhjaGFpbklkVwEBVwELbXVzdEFkZHJlc3MCAWkHYWRkcmVzcwMJAAACCAUBaQZjYWxsZXIFB2FkZHJlc3MGCQACAQIRcGVybWlzc2lvbiBkZW5pZWQBCG11c3RUaGlzAQFpCQELbXVzdEFkZHJlc3MCBQFpBQR0aGlzAAt3YXZlc1N0cmluZwIFV0FWRVMBDHBhcnNlQXNzZXRJZAEFaW5wdXQDCQAAAgUFaW5wdXQFC3dhdmVzU3RyaW5nBQR1bml0CQDZBAEFBWlucHV0AQ9hc3NldElkVG9TdHJpbmcBBWlucHV0AwkAAAIFBWlucHV0BQR1bml0BQt3YXZlc1N0cmluZwkA2AQBCQEFdmFsdWUBBQVpbnB1dAARa1NlcnZpY2VQdWJsaWNLZXkCFCVzX19zZXJ2aWNlUHVibGljS2V5AA1rQm90UHVibGljS2V5AhAlc19fYm90UHVibGljS2V5AA5rQWNjb3Vud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3JpcHQFA25pbAMJAAACBQZjaGVja3MFBmNoZWNrcwQOY3JlYXRvckFkZHJlc3MJAKcIAQUQY3JlYXRvclB1YmxpY0tleQkAlAoCCQDMCAIJAQxJbnRlZ2VyRW50cnkCCQEOa0FjY291bnRTdGF0dXMBBQlhY2NvdW50SWQFFEFDQ09VTlRfU1RBVFVTX1JFQURZCQDMCAIJAQtCaW5hcnlFbnRyeQIJARhrQWNjb3VudENyZWF0b3JQdWJsaWNLZXkBBQlhY2NvdW50SWQFEGNyZWF0b3JQdWJsaWNLZXkJAMwIAgkBC0JpbmFyeUVudHJ5AgkBHGtBY2NvdW50SWRUb0FjY291bnRQdWJsaWNLZXkBBQlhY2NvdW50SWQFEGFjY291bnRQdWJsaWNLZXkJAMwIAgkBC1N0cmluZ0VudHJ5AgkBGmtBY2NvdW50QWRkcmVzc1RvQWNjb3VudElkAQUOYWNjb3VudEFkZHJlc3MFCWFjY291bnRJZAkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDBQ5jcmVhdG9yQWRkcmVzcwkBDHJld2FyZEFtb3VudAAFBHVuaXQFA25pbAUEdW5pdAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgB31fZ8", "height": 2811272, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: ekrk3RoaYGx5v5Sm47tvYU1fNAuUmsg9N85pwhynBd3 Next: FfCyS8xwSAAYPb9DTjHEHZhzGvJ2EfbVxbom5qMCQUts Diff:
Old | New | Differences | |
---|---|---|---|
15 | 15 | ||
16 | 16 | ||
17 | 17 | func mustThis (i) = mustAddress(i, this) | |
18 | + | ||
19 | + | ||
20 | + | let wavesString = "WAVES" | |
21 | + | ||
22 | + | func parseAssetId (input) = if ((input == wavesString)) | |
23 | + | then unit | |
24 | + | else fromBase58String(input) | |
25 | + | ||
26 | + | ||
27 | + | func assetIdToString (input) = if ((input == unit)) | |
28 | + | then wavesString | |
29 | + | else toBase58String(value(input)) | |
18 | 30 | ||
19 | 31 | ||
20 | 32 | let kServicePublicKey = "%s__servicePublicKey" | |
59 | 71 | func kAccountAddressToAccountId (accountAddress) = makeString(["%s%s", toString(accountAddress), "accountAddressToAccountId"], separator) | |
60 | 72 | ||
61 | 73 | ||
62 | - | func kPairAllowed (amountAssetId,priceAssetId) = makeString(["%s%s%s", | |
74 | + | func kPairAllowed (amountAssetId,priceAssetId) = makeString(["%s%s%s", assetIdToString(amountAssetId), assetIdToString(priceAssetId), "pairAllowed"], separator) | |
63 | 75 | ||
64 | 76 | ||
65 | 77 | func pairAllowed (amountAssetId,priceAssetId) = valueOrElse(getBoolean(this, kPairAllowed(amountAssetId, priceAssetId)), false) | |
80 | 92 | ||
81 | 93 | ||
82 | 94 | @Callable(i) | |
83 | - | func request (amountAssetId,priceAssetId) = { | |
84 | - | let accountId = toBase58String(sha256(((i.caller.bytes + amountAssetId) + priceAssetId))) | |
95 | + | func request (amountAssetIdStr,priceAssetIdStr) = { | |
96 | + | let accountId = makeString([toString(i.caller), amountAssetIdStr, priceAssetIdStr], ":") | |
97 | + | let amountAssetId = parseAssetId(amountAssetIdStr) | |
98 | + | let priceAssetId = parseAssetId(priceAssetIdStr) | |
85 | 99 | let checks = [if ((size(i.payments) == 1)) | |
86 | 100 | then true | |
87 | 101 | else throw("1 payment is required"), if ((i.payments[0].assetId == unit)) | |
94 | 108 | then true | |
95 | 109 | else throw("account already exists")] | |
96 | 110 | if ((checks == checks)) | |
97 | - | then $Tuple2([IntegerEntry(kAccountStatus(accountId), 0), BinaryEntry(kAccountOwnerPublicKey(accountId), i.callerPublicKey), | |
111 | + | then $Tuple2([IntegerEntry(kAccountStatus(accountId), 0), BinaryEntry(kAccountOwnerPublicKey(accountId), i.callerPublicKey), StringEntry(kAccountAmountAssetId(accountId), amountAssetIdStr), StringEntry(kAccountPriceAssetId(accountId), priceAssetIdStr)], unit) | |
98 | 112 | else throw("Strict value is not equal to itself.") | |
99 | 113 | } | |
100 | 114 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let separator = "__" | |
5 | 5 | ||
6 | 6 | let chainId = take(drop(this.bytes, 1), 1) | |
7 | 7 | ||
8 | 8 | let chainIdT = base58'2T' | |
9 | 9 | ||
10 | 10 | let chainIdW = base58'2W' | |
11 | 11 | ||
12 | 12 | func mustAddress (i,address) = if ((i.caller == address)) | |
13 | 13 | then true | |
14 | 14 | else throw("permission denied") | |
15 | 15 | ||
16 | 16 | ||
17 | 17 | func mustThis (i) = mustAddress(i, this) | |
18 | + | ||
19 | + | ||
20 | + | let wavesString = "WAVES" | |
21 | + | ||
22 | + | func parseAssetId (input) = if ((input == wavesString)) | |
23 | + | then unit | |
24 | + | else fromBase58String(input) | |
25 | + | ||
26 | + | ||
27 | + | func assetIdToString (input) = if ((input == unit)) | |
28 | + | then wavesString | |
29 | + | else toBase58String(value(input)) | |
18 | 30 | ||
19 | 31 | ||
20 | 32 | let kServicePublicKey = "%s__servicePublicKey" | |
21 | 33 | ||
22 | 34 | let kBotPublicKey = "%s__botPublicKey" | |
23 | 35 | ||
24 | 36 | let kAccountScript = "%s__accountScript" | |
25 | 37 | ||
26 | 38 | func accountScript () = valueOrErrorMessage(getBinary(this, kAccountScript), "account script is not set") | |
27 | 39 | ||
28 | 40 | ||
29 | 41 | let kRewardAmount = "%s__rewardAmount" | |
30 | 42 | ||
31 | 43 | func rewardAmount () = valueOrErrorMessage(getInteger(this, kRewardAmount), "reward amount is not set") | |
32 | 44 | ||
33 | 45 | ||
34 | 46 | let ACCOUNT_STATUS_EMPTY = 0 | |
35 | 47 | ||
36 | 48 | let ACCOUNT_STATUS_READY = 1 | |
37 | 49 | ||
38 | 50 | func kAccountStatus (accountId) = makeString(["%s%s", accountId, "status"], separator) | |
39 | 51 | ||
40 | 52 | ||
41 | 53 | func accountStatus (accountId) = valueOrErrorMessage(getInteger(this, kAccountStatus(accountId)), "account is not found") | |
42 | 54 | ||
43 | 55 | ||
44 | 56 | func kAccountCreatorPublicKey (accountId) = makeString(["%s%s", accountId, "creatorPublicKey"], separator) | |
45 | 57 | ||
46 | 58 | ||
47 | 59 | func kAccountOwnerPublicKey (accountId) = makeString(["%s%s", accountId, "ownerPublicKey"], separator) | |
48 | 60 | ||
49 | 61 | ||
50 | 62 | func kAccountAmountAssetId (accountId) = makeString(["%s%s", accountId, "amountAssetId"], separator) | |
51 | 63 | ||
52 | 64 | ||
53 | 65 | func kAccountPriceAssetId (accountId) = makeString(["%s%s", accountId, "priceAssetId"], separator) | |
54 | 66 | ||
55 | 67 | ||
56 | 68 | func kAccountIdToAccountPublicKey (accountId) = makeString(["%s%s", accountId, "accountIdToAccountPublicKey"], separator) | |
57 | 69 | ||
58 | 70 | ||
59 | 71 | func kAccountAddressToAccountId (accountAddress) = makeString(["%s%s", toString(accountAddress), "accountAddressToAccountId"], separator) | |
60 | 72 | ||
61 | 73 | ||
62 | - | func kPairAllowed (amountAssetId,priceAssetId) = makeString(["%s%s%s", | |
74 | + | func kPairAllowed (amountAssetId,priceAssetId) = makeString(["%s%s%s", assetIdToString(amountAssetId), assetIdToString(priceAssetId), "pairAllowed"], separator) | |
63 | 75 | ||
64 | 76 | ||
65 | 77 | func pairAllowed (amountAssetId,priceAssetId) = valueOrElse(getBoolean(this, kPairAllowed(amountAssetId, priceAssetId)), false) | |
66 | 78 | ||
67 | 79 | ||
68 | 80 | let serviceAddress = addressFromPublicKey(getBinaryValue(this, kServicePublicKey)) | |
69 | 81 | ||
70 | 82 | let botPublicKey = getBinaryValue(this, kBotPublicKey) | |
71 | 83 | ||
72 | 84 | @Callable(i) | |
73 | 85 | func init (servicePublicKey,botPublicKey,accountScript,rewardAmount) = { | |
74 | 86 | let checkCaller = mustThis(i) | |
75 | 87 | if ((checkCaller == checkCaller)) | |
76 | 88 | then $Tuple2([BinaryEntry(kServicePublicKey, servicePublicKey), BinaryEntry(kBotPublicKey, botPublicKey), BinaryEntry(kAccountScript, accountScript), IntegerEntry(kRewardAmount, rewardAmount)], unit) | |
77 | 89 | else throw("Strict value is not equal to itself.") | |
78 | 90 | } | |
79 | 91 | ||
80 | 92 | ||
81 | 93 | ||
82 | 94 | @Callable(i) | |
83 | - | func request (amountAssetId,priceAssetId) = { | |
84 | - | let accountId = toBase58String(sha256(((i.caller.bytes + amountAssetId) + priceAssetId))) | |
95 | + | func request (amountAssetIdStr,priceAssetIdStr) = { | |
96 | + | let accountId = makeString([toString(i.caller), amountAssetIdStr, priceAssetIdStr], ":") | |
97 | + | let amountAssetId = parseAssetId(amountAssetIdStr) | |
98 | + | let priceAssetId = parseAssetId(priceAssetIdStr) | |
85 | 99 | let checks = [if ((size(i.payments) == 1)) | |
86 | 100 | then true | |
87 | 101 | else throw("1 payment is required"), if ((i.payments[0].assetId == unit)) | |
88 | 102 | then true | |
89 | 103 | else throw("invalid asset"), if ((i.payments[0].amount == rewardAmount())) | |
90 | 104 | then true | |
91 | 105 | else throw("invalid amount"), if (pairAllowed(amountAssetId, priceAssetId)) | |
92 | 106 | then true | |
93 | 107 | else throw("pair is not allowed"), if ((getInteger(this, kAccountStatus(accountId)) == unit)) | |
94 | 108 | then true | |
95 | 109 | else throw("account already exists")] | |
96 | 110 | if ((checks == checks)) | |
97 | - | then $Tuple2([IntegerEntry(kAccountStatus(accountId), 0), BinaryEntry(kAccountOwnerPublicKey(accountId), i.callerPublicKey), | |
111 | + | then $Tuple2([IntegerEntry(kAccountStatus(accountId), 0), BinaryEntry(kAccountOwnerPublicKey(accountId), i.callerPublicKey), StringEntry(kAccountAmountAssetId(accountId), amountAssetIdStr), StringEntry(kAccountPriceAssetId(accountId), priceAssetIdStr)], unit) | |
98 | 112 | else throw("Strict value is not equal to itself.") | |
99 | 113 | } | |
100 | 114 | ||
101 | 115 | ||
102 | 116 | ||
103 | 117 | @Callable(i) | |
104 | 118 | func complete (accountId,creatorPublicKey) = { | |
105 | 119 | let accountPublicKey = i.callerPublicKey | |
106 | 120 | let accountAddress = i.caller | |
107 | 121 | let checks = [if ((accountStatus(accountId) == ACCOUNT_STATUS_EMPTY)) | |
108 | 122 | then true | |
109 | 123 | else throw("account is already exists"), if ( match scriptHash(accountAddress) { | |
110 | 124 | case b: ByteVector => | |
111 | 125 | (b == blake2b256_32Kb(accountScript())) | |
112 | 126 | case _ => | |
113 | 127 | false | |
114 | 128 | }) | |
115 | 129 | then true | |
116 | 130 | else throw("invalid script")] | |
117 | 131 | if ((checks == checks)) | |
118 | 132 | then { | |
119 | 133 | let creatorAddress = addressFromPublicKey(creatorPublicKey) | |
120 | 134 | $Tuple2([IntegerEntry(kAccountStatus(accountId), ACCOUNT_STATUS_READY), BinaryEntry(kAccountCreatorPublicKey(accountId), creatorPublicKey), BinaryEntry(kAccountIdToAccountPublicKey(accountId), accountPublicKey), StringEntry(kAccountAddressToAccountId(accountAddress), accountId), ScriptTransfer(creatorAddress, rewardAmount(), unit)], unit) | |
121 | 135 | } | |
122 | 136 | else throw("Strict value is not equal to itself.") | |
123 | 137 | } | |
124 | 138 | ||
125 | 139 |
github/deemru/w8io/026f985 39.58 ms ◑