tx · 44vg4L9cJkE9mEst25273wkdc218MaRffK1hNeTSkfsh
3NBbFNBed9tcU5AmsJAuExWvgJyNmJxqjWq: -0.01000000 Waves
2023.05.14 01:48 [2576784] smart account 3NBbFNBed9tcU5AmsJAuExWvgJyNmJxqjWq > SELF 0.00000000 Waves
{
"type": 13,
"id": "44vg4L9cJkE9mEst25273wkdc218MaRffK1hNeTSkfsh",
"fee": 1000000,
"feeAssetId": null,
"timestamp": 1684018139907,
"version": 2,
"chainId": 84,
"sender": "3NBbFNBed9tcU5AmsJAuExWvgJyNmJxqjWq",
"senderPublicKey": "ERewvWFUFQfR1eCnipNAv9n7SdQhof2ESP6PGVjTueLd",
"proofs": [
"q2q1ypgV6ztHLna7naUL36B9DsU9PMXPg2sZbVwM2wRPY5Yon8pHycfUZYEjDwf4D2DfyXVfiYovg8ueZZXNUTh"
],
"script": "base64:BgIICAISBAoCCAEAAQFpAQZib3Jyb3cCCmFzc2V0SWRTdHILYXNzZXRBbW91bnQED3NtYXJ0Y29udHJhY3RJZAkBB0FkZHJlc3MBARoBVJHyspw5c5zCcXIim0BCoGwdZ5WG+0VDrgQHYWRkcmVzcwkApQgBCAUBaQZjYWxsZXIEA3JlcwkA/AcEBQ9zbWFydGNvbnRyYWN0SWQCBmJvcnJvdwkAzAgCCQERQGV4dHJOYXRpdmUoMTA2MikBBQphc3NldElkU3RyCQDMCAIFC2Fzc2V0QW1vdW50BQNuaWwJAMwIAgkBD0F0dGFjaGVkUGF5bWVudAIFBHVuaXQAgMLXLwUDbmlsAwkAAAIFA3JlcwUDcmVzBAckbWF0Y2gwBQNyZXMDCQABAgUHJG1hdGNoMAIDSW50BAFyBQckbWF0Y2gwCQCUCgIJAMwIAgkBDEludGVnZXJFbnRyeQIJAKwCAgkArAICBQdhZGRyZXNzAgpfYm9ycm93ZWRfBQphc3NldElkU3RyBQFyBQNuaWwFAXIJAAIBAhdJbmNvcnJlY3QgaW52b2tlIHJlc3VsdAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgECdHgBBnZlcmlmeQAJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXm5FYMw",
"height": 2576784,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: FVzAxdMPtwkaJEMr4tt7cY5L8BqufKk66DuVUBBYV81B
Next: 36WjD6myuJv7uGGJbo1D4AMryB3CoHF3tZmxkLvuAXG3
Diff:
Old | New | | Differences |
---|
1 | | - | {-# STDLIB_VERSION 5 #-} |
---|
| 1 | + | {-# STDLIB_VERSION 6 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | | - | let recipient = Address(base58'') |
---|
5 | | - | |
---|
6 | | - | let usdtAssetId = Address(base58'') |
---|
7 | | - | |
---|
8 | | - | @Callable(i) |
---|
9 | | - | func deposit () = if ((i.payments[0].assetId != unit)) |
---|
10 | | - | then throw("Can only deposit Waves") |
---|
11 | | - | else { |
---|
12 | | - | let wavesAmount = i.payments[0].amount |
---|
13 | | - | let currentKey = toBase58String(i.caller.bytes) |
---|
14 | | - | let currentAmount = match getInteger(this, currentKey) { |
---|
15 | | - | case a: Int => |
---|
16 | | - | a |
---|
17 | | - | case _ => |
---|
18 | | - | 0 |
---|
19 | | - | } |
---|
20 | | - | let newAmount = ((currentAmount - wavesAmount) - 100000) |
---|
21 | | - | [ScriptTransfer(recipient, (wavesAmount - 100000), unit)] |
---|
22 | | - | } |
---|
23 | | - | |
---|
24 | 4 | | |
---|
25 | 5 | | |
---|
26 | 6 | | @Callable(i) |
---|
27 | | - | func withdraw (amount) = { |
---|
28 | | - | let currentKey = toBase58String(i.caller.bytes) |
---|
29 | | - | let currentAmount = match getInteger(this, currentKey) { |
---|
30 | | - | case a: Int => |
---|
31 | | - | a |
---|
32 | | - | case _ => |
---|
33 | | - | 0 |
---|
| 7 | + | func borrow (assetIdStr,assetAmount) = { |
---|
| 8 | + | let smartcontractId = Address(base58'3N3DnVffnUyZtz2MRbk5U7giN112WempMNd') |
---|
| 9 | + | let address = toString(i.caller) |
---|
| 10 | + | let res = invoke(smartcontractId, "borrow", [addressFromStringValue(assetIdStr), assetAmount], [AttachedPayment(unit, 100000000)]) |
---|
| 11 | + | if ((res == res)) |
---|
| 12 | + | then match res { |
---|
| 13 | + | case r: Int => |
---|
| 14 | + | $Tuple2([IntegerEntry(((address + "_borrowed_") + assetIdStr), r)], r) |
---|
| 15 | + | case _ => |
---|
| 16 | + | throw("Incorrect invoke result") |
---|
| 17 | + | } |
---|
| 18 | + | else throw("Strict value is not equal to itself.") |
---|
34 | 19 | | } |
---|
35 | | - | if ((0 > amount)) |
---|
36 | | - | then throw("Can't withdraw negative amount") |
---|
37 | | - | else nil |
---|
38 | | - | } |
---|
39 | | - | |
---|
40 | | - | |
---|
41 | | - | |
---|
42 | | - | @Callable(i) |
---|
43 | | - | func mint () = nil |
---|
44 | 20 | | |
---|
45 | 21 | | |
---|
46 | 22 | | @Verifier(tx) |
---|
Full:
Old | New | | Differences |
---|
1 | | - | {-# STDLIB_VERSION 5 #-} |
---|
| 1 | + | {-# STDLIB_VERSION 6 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | | - | let recipient = Address(base58'') |
---|
5 | | - | |
---|
6 | | - | let usdtAssetId = Address(base58'') |
---|
7 | | - | |
---|
8 | | - | @Callable(i) |
---|
9 | | - | func deposit () = if ((i.payments[0].assetId != unit)) |
---|
10 | | - | then throw("Can only deposit Waves") |
---|
11 | | - | else { |
---|
12 | | - | let wavesAmount = i.payments[0].amount |
---|
13 | | - | let currentKey = toBase58String(i.caller.bytes) |
---|
14 | | - | let currentAmount = match getInteger(this, currentKey) { |
---|
15 | | - | case a: Int => |
---|
16 | | - | a |
---|
17 | | - | case _ => |
---|
18 | | - | 0 |
---|
19 | | - | } |
---|
20 | | - | let newAmount = ((currentAmount - wavesAmount) - 100000) |
---|
21 | | - | [ScriptTransfer(recipient, (wavesAmount - 100000), unit)] |
---|
22 | | - | } |
---|
23 | | - | |
---|
24 | 4 | | |
---|
25 | 5 | | |
---|
26 | 6 | | @Callable(i) |
---|
27 | | - | func withdraw (amount) = { |
---|
28 | | - | let currentKey = toBase58String(i.caller.bytes) |
---|
29 | | - | let currentAmount = match getInteger(this, currentKey) { |
---|
30 | | - | case a: Int => |
---|
31 | | - | a |
---|
32 | | - | case _ => |
---|
33 | | - | 0 |
---|
| 7 | + | func borrow (assetIdStr,assetAmount) = { |
---|
| 8 | + | let smartcontractId = Address(base58'3N3DnVffnUyZtz2MRbk5U7giN112WempMNd') |
---|
| 9 | + | let address = toString(i.caller) |
---|
| 10 | + | let res = invoke(smartcontractId, "borrow", [addressFromStringValue(assetIdStr), assetAmount], [AttachedPayment(unit, 100000000)]) |
---|
| 11 | + | if ((res == res)) |
---|
| 12 | + | then match res { |
---|
| 13 | + | case r: Int => |
---|
| 14 | + | $Tuple2([IntegerEntry(((address + "_borrowed_") + assetIdStr), r)], r) |
---|
| 15 | + | case _ => |
---|
| 16 | + | throw("Incorrect invoke result") |
---|
| 17 | + | } |
---|
| 18 | + | else throw("Strict value is not equal to itself.") |
---|
34 | 19 | | } |
---|
35 | | - | if ((0 > amount)) |
---|
36 | | - | then throw("Can't withdraw negative amount") |
---|
37 | | - | else nil |
---|
38 | | - | } |
---|
39 | | - | |
---|
40 | | - | |
---|
41 | | - | |
---|
42 | | - | @Callable(i) |
---|
43 | | - | func mint () = nil |
---|
44 | 20 | | |
---|
45 | 21 | | |
---|
46 | 22 | | @Verifier(tx) |
---|
47 | 23 | | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) |
---|
48 | 24 | | |
---|