tx · AyFGwsQDkFzXTv7fJXaiwFv9wCWJvd8PQbZCgKgVFbw9 3Mvqg45GNNEhYssByz8tT6BECpZd8wKyuki: -0.00100000 Waves 2024.07.06 01:04 [3181280] smart account 3Mvqg45GNNEhYssByz8tT6BECpZd8wKyuki > SELF 0.00000000 Waves
{ "type": 13, "id": "AyFGwsQDkFzXTv7fJXaiwFv9wCWJvd8PQbZCgKgVFbw9", "fee": 100000, "feeAssetId": null, "timestamp": 1720217111689, "version": 2, "chainId": 84, "sender": "3Mvqg45GNNEhYssByz8tT6BECpZd8wKyuki", "senderPublicKey": "Em3xR3qCDVUJh4RYP61j2iaMKdEHYvyYEA4kmBMKQHLd", "proofs": [ "9jZSyuBAQxX3Gw8PGX66Cp8LxsQpN8LHJ3yG5ULqWmfEdGQo2G5D3ML1mHDv8zLf4k96FB3U51dMobmRjGjEmL1" ], "script": "base64:BgIJCAISABIDCgEBAAIBaQEHZGVwb3NpdAAEB3BheW1lbnQJAQV2YWx1ZQEIBQFpCHBheW1lbnRzAwMJAGYCCQCQAwEFB3BheW1lbnQAAQYJAQlpc0RlZmluZWQBCAkAkQMCBQdwYXltZW50AAAHYXNzZXRJZAkAAgECKFlvdSBjYW4gb25seSBvbmUgV0FWRVMgZGVwb3NpdCBhdCBhIHRpbWUECmN1cnJlbnRLZXkJANgEAQgIBQFpBmNhbGxlcgVieXRlcwQNY3VycmVudEFtb3VudAkBC3ZhbHVlT3JFbHNlAgkAmggCBQR0aGlzBQpjdXJyZW50S2V5AAAECW5ld0Ftb3VudAkAZAIFDWN1cnJlbnRBbW91bnQICQCRAwIFB3BheW1lbnQAAAZhbW91bnQJAMwIAgkBDEludGVnZXJFbnRyeQIFCmN1cnJlbnRLZXkFCW5ld0Ftb3VudAUDbmlsAWkBCHdpdGhkcmF3AQZhbW91bnQECmN1cnJlbnRLZXkJANgEAQgIBQFpBmNhbGxlcgVieXRlcwQNY3VycmVudEFtb3VudAkBC3ZhbHVlT3JFbHNlAgkAmggCBQR0aGlzBQpjdXJyZW50S2V5AAAECW5ld0Ftb3VudAkAZQIFDWN1cnJlbnRBbW91bnQFBmFtb3VudAMJAGYCAAAFBmFtb3VudAkAAgECH0Nhbm5vdCB3aXRoZHJhdyBuZWdhdGl2ZSBhbW91bnQDCQBmAgAABQluZXdBbW91bnQJAAIBAhJOb3QgZW5vdWdoIGJhbGFuY2UJAMwIAgkBDEludGVnZXJFbnRyeQIFCmN1cnJlbnRLZXkFCW5ld0Ftb3VudAkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDCAUBaQZjYWxsZXIFBmFtb3VudAUEdW5pdAUDbmlsAQJ0eAEGdmVyaWZ5AAQHJG1hdGNoMAUCdHgDCQABAgUHJG1hdGNoMAIUU2V0U2NyaXB0VHJhbnNhY3Rpb24EC3NldFNjcmlwdFR4BQckbWF0Y2gwBwkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleUmsbSU=", "height": 3181280, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 83GsDA8yYuEj2ncaReeMuNm2aoxzEkhghE32ZSAcLsni Next: none Diff:
Old | New | Differences | |
---|---|---|---|
4 | 4 | ||
5 | 5 | ||
6 | 6 | @Callable(i) | |
7 | - | func storeData (newKey,newValue) = { | |
8 | - | let slot = getInteger(this, newKey) | |
9 | - | if (isDefined(slot)) | |
10 | - | then throw("Key already exists") | |
11 | - | else [IntegerEntry(newKey, newValue)] | |
7 | + | func deposit () = { | |
8 | + | let payment = value(i.payments) | |
9 | + | if (if ((size(payment) > 1)) | |
10 | + | then true | |
11 | + | else isDefined(payment[0].assetId)) | |
12 | + | then throw("You can only one WAVES deposit at a time") | |
13 | + | else { | |
14 | + | let currentKey = toBase58String(i.caller.bytes) | |
15 | + | let currentAmount = valueOrElse(getInteger(this, currentKey), 0) | |
16 | + | let newAmount = (currentAmount + payment[0].amount) | |
17 | + | [IntegerEntry(currentKey, newAmount)] | |
18 | + | } | |
19 | + | } | |
20 | + | ||
21 | + | ||
22 | + | ||
23 | + | @Callable(i) | |
24 | + | func withdraw (amount) = { | |
25 | + | let currentKey = toBase58String(i.caller.bytes) | |
26 | + | let currentAmount = valueOrElse(getInteger(this, currentKey), 0) | |
27 | + | let newAmount = (currentAmount - amount) | |
28 | + | if ((0 > amount)) | |
29 | + | then throw("Cannot withdraw negative amount") | |
30 | + | else if ((0 > newAmount)) | |
31 | + | then throw("Not enough balance") | |
32 | + | else [IntegerEntry(currentKey, newAmount), ScriptTransfer(i.caller, amount, unit)] | |
12 | 33 | } | |
13 | 34 | ||
14 | 35 | ||
15 | 36 | @Verifier(tx) | |
16 | 37 | func verify () = match tx { | |
17 | - | case | |
18 | - | | |
38 | + | case setScriptTx: SetScriptTransaction => | |
39 | + | false | |
19 | 40 | case _ => | |
20 | 41 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
21 | 42 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | ||
5 | 5 | ||
6 | 6 | @Callable(i) | |
7 | - | func storeData (newKey,newValue) = { | |
8 | - | let slot = getInteger(this, newKey) | |
9 | - | if (isDefined(slot)) | |
10 | - | then throw("Key already exists") | |
11 | - | else [IntegerEntry(newKey, newValue)] | |
7 | + | func deposit () = { | |
8 | + | let payment = value(i.payments) | |
9 | + | if (if ((size(payment) > 1)) | |
10 | + | then true | |
11 | + | else isDefined(payment[0].assetId)) | |
12 | + | then throw("You can only one WAVES deposit at a time") | |
13 | + | else { | |
14 | + | let currentKey = toBase58String(i.caller.bytes) | |
15 | + | let currentAmount = valueOrElse(getInteger(this, currentKey), 0) | |
16 | + | let newAmount = (currentAmount + payment[0].amount) | |
17 | + | [IntegerEntry(currentKey, newAmount)] | |
18 | + | } | |
19 | + | } | |
20 | + | ||
21 | + | ||
22 | + | ||
23 | + | @Callable(i) | |
24 | + | func withdraw (amount) = { | |
25 | + | let currentKey = toBase58String(i.caller.bytes) | |
26 | + | let currentAmount = valueOrElse(getInteger(this, currentKey), 0) | |
27 | + | let newAmount = (currentAmount - amount) | |
28 | + | if ((0 > amount)) | |
29 | + | then throw("Cannot withdraw negative amount") | |
30 | + | else if ((0 > newAmount)) | |
31 | + | then throw("Not enough balance") | |
32 | + | else [IntegerEntry(currentKey, newAmount), ScriptTransfer(i.caller, amount, unit)] | |
12 | 33 | } | |
13 | 34 | ||
14 | 35 | ||
15 | 36 | @Verifier(tx) | |
16 | 37 | func verify () = match tx { | |
17 | - | case | |
18 | - | | |
38 | + | case setScriptTx: SetScriptTransaction => | |
39 | + | false | |
19 | 40 | case _ => | |
20 | 41 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
21 | 42 | } | |
22 | 43 |
github/deemru/w8io/03bedc9 20.94 ms ◑![]()