tx · AMKdJPzPu3XYZjEQ1HKDBa1kxtmcHjtVFaqZLtqbVyFb
3MzsPnBwpkEPGZZb5wrDHeBdvdLWBHHc85Y: -0.01400002 Waves
2019.12.30 20:25 [832125] smart account 3MzsPnBwpkEPGZZb5wrDHeBdvdLWBHHc85Y > SELF 0.00000000 Waves
{
"type": 13,
"id": "AMKdJPzPu3XYZjEQ1HKDBa1kxtmcHjtVFaqZLtqbVyFb",
"fee": 1400002,
"feeAssetId": null,
"timestamp": 1577726689698,
"version": 1,
"sender": "3MzsPnBwpkEPGZZb5wrDHeBdvdLWBHHc85Y",
"senderPublicKey": "6386TjwUeCqp7PTkFt3quPcZwHFfSqF5X6TaA9JGmiGD",
"proofs": [
"63yxLtTCqrDZqvfLZ1XHKs4rCt8xEf4WwNwSCHYDHN1fNbWvtvp5W1knWdQT9CA9kMMHKtTwr2rBCDTEWdi6D8QA"
],
"script": "base64:AAIDAAAAAAAAAAkIARIAEgMKAQgAAAACAAAAABVyZXdhcmRQZXJjZW50UGVyTW9udGgAAAAAAAAAC7gAAAAAB2Fzc2V0SUQBAAAAIM8nlSfCfmvawtYqmd0YxYDdTXWBH3ARhaADeaA3oQCYAAAAAgAAAAFpAQAAAAlnZXRSZXdhcmQAAAAABAAAAA5zdGFraW5nQmFsYW5jZQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzCQABLAAAAAIJAAQlAAAAAQgFAAAAAWkAAAAGY2FsbGVyAgAAAA9fc3Rha2luZ0JhbGFuY2UDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAQAAAANc3Rha2luZ0hlaWdodAQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzCQABLAAAAAIJAAQlAAAAAQgFAAAAAWkAAAAGY2FsbGVyAgAAAA5fc3Rha2luZ0hlaWdodAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAA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aDAFAAAAAWEAAAAAAAAAAAAJAQAAAAxTY3JpcHRSZXN1bHQAAAACCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIJAAQlAAAAAQgFAAAAAWkAAAAGY2FsbGVyAgAAAA9fc3Rha2luZ0JhbGFuY2UJAABkAAAAAggFAAAAA3BtdAAAAAZhbW91bnQFAAAADnN0YWtpbmdCYWxhbmNlCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIJAAQlAAAAAQgFAAAAAWkAAAAGY2FsbGVyAgAAAA5fc3Rha2luZ0hlaWdodAUAAAAGaGVpZ2h0BQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwkBAAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZykAAAABBQAAAA1yZWZlcmFsQWRyZXNzCQAAaAAAAAIJAABpAAAAAggFAAAAA3BtdAAAAAZhbW91bnQAAAAAAAAAAGQFAAAADnJlZmVyYWxQZXJjZW50BQAAAAdhc3NldElEBQAAAANuaWwAAAAA6T3TyQ==",
"chainId": 84,
"height": 832125,
"spentComplexity": 0
}
View: original | compacted
Prev: 7K2643pDNxqhy7xWgqfPRH3iLAMLAnYL1jGwJY4ZPF8K
Next: none
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 3 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
| 4 | + | let rewardPercentPerMonth = 3000 |
---|
| 5 | + | |
---|
| 6 | + | let assetID = base58'EweQEMhC4tk3ae6E2N5wtsJBzvzRHsgqQZjoAk4xNnZm' |
---|
| 7 | + | |
---|
| 8 | + | @Callable(i) |
---|
| 9 | + | func getReward () = { |
---|
| 10 | + | let stakingBalance = match getInteger(this, (toString(i.caller) + "_stakingBalance")) { |
---|
| 11 | + | case a: Int => |
---|
| 12 | + | a |
---|
| 13 | + | case _ => |
---|
| 14 | + | 0 |
---|
| 15 | + | } |
---|
| 16 | + | let stakingHeight = match getInteger(this, (toString(i.caller) + "_stakingHeight")) { |
---|
| 17 | + | case a: Int => |
---|
| 18 | + | a |
---|
| 19 | + | case _ => |
---|
| 20 | + | 0 |
---|
| 21 | + | } |
---|
| 22 | + | let reward = (((((((height - stakingHeight) / 60) / 24) / 30) / rewardPercentPerMonth) / 100) * stakingBalance) |
---|
| 23 | + | ScriptResult(WriteSet([DataEntry((toString(i.caller) + "_stakingHeight"), height)]), TransferSet([ScriptTransfer(i.caller, reward, assetID)])) |
---|
| 24 | + | } |
---|
| 25 | + | |
---|
4 | 26 | | |
---|
5 | 27 | | |
---|
6 | 28 | | @Callable(i) |
---|
7 | | - | func buildFactory () = { |
---|
| 29 | + | func staking (referalAdress) = { |
---|
| 30 | + | let referalPercent = 5 |
---|
8 | 31 | | let pmt = extract(i.payment) |
---|
9 | | - | let assetID = base58'EweQEMhC4tk3ae6E2N5wtsJBzvzRHsgqQZjoAk4xNnZm' |
---|
10 | | - | let factoryID = base58'9TiJLEojFpqRFwTFddKfrLu8ZWbZa1HW1tDug83uGeVQ' |
---|
11 | | - | let countFactory = assetBalance(this, factoryID) |
---|
12 | 32 | | if ((pmt.assetId != assetID)) |
---|
13 | | - | then throw("Завод можно купить за монеты") |
---|
14 | | - | else if ((pmt.amount != 10)) |
---|
15 | | - | then throw("Завод стоит 10 монет") |
---|
16 | | - | else if ((countFactory == 0)) |
---|
17 | | - | then throw("Заводов нет в наличии") |
---|
18 | | - | else TransferSet([ScriptTransfer(i.caller, 1, factoryID)]) |
---|
| 33 | + | then throw("Стейковать можно только монеты") |
---|
| 34 | + | else { |
---|
| 35 | + | let stakingBalance = match getInteger(this, (toString(i.caller) + "_stakingBalance")) { |
---|
| 36 | + | case a: Int => |
---|
| 37 | + | a |
---|
| 38 | + | case _ => |
---|
| 39 | + | 0 |
---|
| 40 | + | } |
---|
| 41 | + | ScriptResult(WriteSet([DataEntry((toString(i.caller) + "_stakingBalance"), (pmt.amount + stakingBalance)), DataEntry((toString(i.caller) + "_stakingHeight"), height)]), TransferSet([ScriptTransfer(addressFromStringValue(referalAdress), ((pmt.amount / 100) * referalPercent), assetID)])) |
---|
| 42 | + | } |
---|
19 | 43 | | } |
---|
20 | 44 | | |
---|
21 | 45 | | |
---|