tx · 7fpkbU5g8CPCG3y2TD3ZKHrGUSBG6kYgmUzpJzeBjVMn
3Mu35ZY17eYKTNJDAt3waBLGKuC398ZK9ha: -0.09990000 Waves
2020.10.16 23:22 [1223609] smart account 3Mu35ZY17eYKTNJDAt3waBLGKuC398ZK9ha > SELF 0.00000000 Waves
{
"type": 13,
"id": "7fpkbU5g8CPCG3y2TD3ZKHrGUSBG6kYgmUzpJzeBjVMn",
"fee": 9990000,
"feeAssetId": null,
"timestamp": 1602879722547,
"version": 2,
"chainId": 84,
"sender": "3Mu35ZY17eYKTNJDAt3waBLGKuC398ZK9ha",
"senderPublicKey": "ex6ShQCmaXZr3wDm8wGbC3EMesy4a8hsg3hoF1gqDqJ",
"proofs": [
"5YNT4FyvHT6cfWjwyfnDD9RFGv9LSfYu6X7hXDtXreQdCKR6H62FiK9uD5Xbdn6TsTDCxhPcWx2fb2i6MtP5AeKY"
],
"script": "base64:AAIDAAAAAAAAAA0IARIAEgASAwoBARIAAAAAAAAAAAQAAAABaQEAAAAIcGF5WWllbGQAAAAABAAAAAtHb3Zlcm5Ub2tlbgEAAAAgvAZyzUx++c2P/OaSk4N3DovQ0UYK2akT0ub7yzxoPM0EAAAACmN1cnJlbnRLZXkJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAANY3VycmVudEFtb3VudAQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAApjdXJyZW50S2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAADCQAAZgAAAAIFAAAADWN1cnJlbnRBbW91bnQAAAAAAAAAAAAEAAAABmFtb3VudAkAA+sAAAACBQAAAAR0aGlzBQAAAAtHb3Zlcm5Ub2tlbgMJAABmAAAAAgAAAAAAAAAAAQUAAAAGYW1vdW50CQAAAgAAAAECAAAAIU5vIGVub3VnaCBHb3Zlcm5Ub2tlbiBJbiBDb250c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GP2jvCbtpj52Gvg2osXltv2/UMEAAAAC3dpbm5lclByaXplAgAAACMzTjFRelVIZGZ5WG1LVkZBbjlUUEhHN2l1VzR1SzUzcGZYQQQAAAAKd2luQWRkcmVzcwkBAAAAB0FkZHJlc3MAAAABAQAAABoBVH4hBNl5CDl8l8M2ULNhU20EFF7BOvGXpQQAAAANY3VycmVudEFtb3VudAQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzAgAAACMzTkNNcmhQQVZxWGd0TGRwaTJCaEZXcEprTUJVQUZyb3piRAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAAAwkAAAAAAAACBQAAAA1jdXJyZW50QW1vdW50AAAAAAAAAAAACQAAAgAAAAECAAAAD05vIFByaXplIHRvIHdpbgkBAAAADFNjcmlwdFJlc3VsdAAAAAIJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAAC3dpbm5lclByaXplBQAAAA1jdXJyZW50QW1vdW50BQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAAKd2luQWRkcmVzcwUAAAANY3VycmVudEFtb3VudAUAAAAPQ29sbGF0ZXJhbFRva2VuBQAAAANuaWwAAAAAHQwHaw==",
"height": 1223609,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: 2Qp12fZwLwVAPpCiue1oQXGCPANFKZiZy5ByGNhMsLSr
Next: DjfXQKzcFGq3BytdXUop9aKB7Y4gdCK77Y1C3PEM8myS
Diff:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 3 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
| 4 | + | |
---|
| 5 | + | |
---|
| 6 | + | @Callable(i) |
---|
| 7 | + | func payYield () = { |
---|
| 8 | + | let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ' |
---|
| 9 | + | let currentKey = toBase58String(i.caller.bytes) |
---|
| 10 | + | let currentAmount = match getInteger(this, currentKey) { |
---|
| 11 | + | case a: Int => |
---|
| 12 | + | a |
---|
| 13 | + | case _ => |
---|
| 14 | + | 0 |
---|
| 15 | + | } |
---|
| 16 | + | if ((currentAmount > 0)) |
---|
| 17 | + | then { |
---|
| 18 | + | let amount = assetBalance(this, GovernToken) |
---|
| 19 | + | if ((1 > amount)) |
---|
| 20 | + | then throw("No enough GovernToken In Contract") |
---|
| 21 | + | else ScriptResult(WriteSet([DataEntry(currentKey, 10)]), TransferSet([ScriptTransfer(i.caller, 1, GovernToken)])) |
---|
| 22 | + | } |
---|
| 23 | + | else throw("You need to deposit Collateral Token to receive Govern Token") |
---|
| 24 | + | } |
---|
| 25 | + | |
---|
4 | 26 | | |
---|
5 | 27 | | |
---|
6 | 28 | | @Callable(i) |
---|
|
27 | 49 | | |
---|
28 | 50 | | |
---|
29 | 51 | | @Callable(i) |
---|
30 | | - | func withdraw (amount) = { |
---|
| 52 | + | func withdrawFunds (amount) = { |
---|
31 | 53 | | let CollateralToken = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN' |
---|
32 | 54 | | let currentKey = toBase58String(i.caller.bytes) |
---|
33 | 55 | | let currentAmount = match getInteger(this, currentKey) { |
---|
|
47 | 69 | | |
---|
48 | 70 | | |
---|
49 | 71 | | @Callable(i) |
---|
50 | | - | func payYield () = { |
---|
51 | | - | let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ' |
---|
52 | | - | let currentKey = toBase58String(i.caller.bytes) |
---|
53 | | - | let currentAmount = match getInteger(this, currentKey) { |
---|
| 72 | + | func WinPremio () = { |
---|
| 73 | + | let CollateralToken = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN' |
---|
| 74 | + | let winnerPrize = "3N1QzUHdfyXmKVFAn9TPHG7iuW4uK53pfXA" |
---|
| 75 | + | let winAddress = Address(base58'3N1QzUHdfyXmKVFAn9TPHG7iuW4uK53pfXA') |
---|
| 76 | + | let currentAmount = match getInteger(this, "3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD") { |
---|
54 | 77 | | case a: Int => |
---|
55 | 78 | | a |
---|
56 | 79 | | case _ => |
---|
57 | 80 | | 0 |
---|
58 | 81 | | } |
---|
59 | | - | if ((currentAmount > 0)) |
---|
60 | | - | then { |
---|
61 | | - | let amount = assetBalance(this, GovernToken) |
---|
62 | | - | if ((10 > amount)) |
---|
63 | | - | then throw("No enough GovernToken In Contract") |
---|
64 | | - | else ScriptResult(WriteSet([DataEntry(currentKey, 10)]), TransferSet([ScriptTransfer(i.caller, 10, GovernToken)])) |
---|
65 | | - | } |
---|
66 | | - | else throw("You need to deposit Collateral Token to receive Govern Token") |
---|
| 82 | + | if ((currentAmount == 0)) |
---|
| 83 | + | then throw("No Prize to win") |
---|
| 84 | + | else ScriptResult(WriteSet([DataEntry(winnerPrize, currentAmount)]), TransferSet([ScriptTransfer(winAddress, currentAmount, CollateralToken)])) |
---|
67 | 85 | | } |
---|
68 | 86 | | |
---|
69 | 87 | | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 3 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
| 4 | + | |
---|
| 5 | + | |
---|
| 6 | + | @Callable(i) |
---|
| 7 | + | func payYield () = { |
---|
| 8 | + | let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ' |
---|
| 9 | + | let currentKey = toBase58String(i.caller.bytes) |
---|
| 10 | + | let currentAmount = match getInteger(this, currentKey) { |
---|
| 11 | + | case a: Int => |
---|
| 12 | + | a |
---|
| 13 | + | case _ => |
---|
| 14 | + | 0 |
---|
| 15 | + | } |
---|
| 16 | + | if ((currentAmount > 0)) |
---|
| 17 | + | then { |
---|
| 18 | + | let amount = assetBalance(this, GovernToken) |
---|
| 19 | + | if ((1 > amount)) |
---|
| 20 | + | then throw("No enough GovernToken In Contract") |
---|
| 21 | + | else ScriptResult(WriteSet([DataEntry(currentKey, 10)]), TransferSet([ScriptTransfer(i.caller, 1, GovernToken)])) |
---|
| 22 | + | } |
---|
| 23 | + | else throw("You need to deposit Collateral Token to receive Govern Token") |
---|
| 24 | + | } |
---|
| 25 | + | |
---|
4 | 26 | | |
---|
5 | 27 | | |
---|
6 | 28 | | @Callable(i) |
---|
7 | 29 | | func deposit () = { |
---|
8 | 30 | | let CollateralToken = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN' |
---|
9 | 31 | | let pmt = extract(i.payment) |
---|
10 | 32 | | if (if (isDefined(pmt.assetId)) |
---|
11 | 33 | | then (extract(pmt.assetId) == CollateralToken) |
---|
12 | 34 | | else false) |
---|
13 | 35 | | then { |
---|
14 | 36 | | let currentKey = toBase58String(i.caller.bytes) |
---|
15 | 37 | | let currentAmount = match getInteger(this, currentKey) { |
---|
16 | 38 | | case a: Int => |
---|
17 | 39 | | a |
---|
18 | 40 | | case _ => |
---|
19 | 41 | | 0 |
---|
20 | 42 | | } |
---|
21 | 43 | | let newAmount = (currentAmount + pmt.amount) |
---|
22 | 44 | | WriteSet([DataEntry(currentKey, newAmount)]) |
---|
23 | 45 | | } |
---|
24 | 46 | | else throw("Can deposit only MyToken") |
---|
25 | 47 | | } |
---|
26 | 48 | | |
---|
27 | 49 | | |
---|
28 | 50 | | |
---|
29 | 51 | | @Callable(i) |
---|
30 | | - | func withdraw (amount) = { |
---|
| 52 | + | func withdrawFunds (amount) = { |
---|
31 | 53 | | let CollateralToken = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN' |
---|
32 | 54 | | let currentKey = toBase58String(i.caller.bytes) |
---|
33 | 55 | | let currentAmount = match getInteger(this, currentKey) { |
---|
34 | 56 | | case a: Int => |
---|
35 | 57 | | a |
---|
36 | 58 | | case _ => |
---|
37 | 59 | | 0 |
---|
38 | 60 | | } |
---|
39 | 61 | | let newAmount = (currentAmount - amount) |
---|
40 | 62 | | if ((0 > amount)) |
---|
41 | 63 | | then throw("Can't withdraw negative amount") |
---|
42 | 64 | | else if ((0 > newAmount)) |
---|
43 | 65 | | then throw("User cannot withdraw more than deposited funds") |
---|
44 | 66 | | else ScriptResult(WriteSet([DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, CollateralToken)])) |
---|
45 | 67 | | } |
---|
46 | 68 | | |
---|
47 | 69 | | |
---|
48 | 70 | | |
---|
49 | 71 | | @Callable(i) |
---|
50 | | - | func payYield () = { |
---|
51 | | - | let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ' |
---|
52 | | - | let currentKey = toBase58String(i.caller.bytes) |
---|
53 | | - | let currentAmount = match getInteger(this, currentKey) { |
---|
| 72 | + | func WinPremio () = { |
---|
| 73 | + | let CollateralToken = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN' |
---|
| 74 | + | let winnerPrize = "3N1QzUHdfyXmKVFAn9TPHG7iuW4uK53pfXA" |
---|
| 75 | + | let winAddress = Address(base58'3N1QzUHdfyXmKVFAn9TPHG7iuW4uK53pfXA') |
---|
| 76 | + | let currentAmount = match getInteger(this, "3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD") { |
---|
54 | 77 | | case a: Int => |
---|
55 | 78 | | a |
---|
56 | 79 | | case _ => |
---|
57 | 80 | | 0 |
---|
58 | 81 | | } |
---|
59 | | - | if ((currentAmount > 0)) |
---|
60 | | - | then { |
---|
61 | | - | let amount = assetBalance(this, GovernToken) |
---|
62 | | - | if ((10 > amount)) |
---|
63 | | - | then throw("No enough GovernToken In Contract") |
---|
64 | | - | else ScriptResult(WriteSet([DataEntry(currentKey, 10)]), TransferSet([ScriptTransfer(i.caller, 10, GovernToken)])) |
---|
65 | | - | } |
---|
66 | | - | else throw("You need to deposit Collateral Token to receive Govern Token") |
---|
| 82 | + | if ((currentAmount == 0)) |
---|
| 83 | + | then throw("No Prize to win") |
---|
| 84 | + | else ScriptResult(WriteSet([DataEntry(winnerPrize, currentAmount)]), TransferSet([ScriptTransfer(winAddress, currentAmount, CollateralToken)])) |
---|
67 | 85 | | } |
---|
68 | 86 | | |
---|
69 | 87 | | |
---|