tx · HYXMZQVk1TtVcYjtyUoYn3wBq7YNX6nM5rme1QFV7ejr
3P6QCup9ZgsBg8LLzk7dCa8MnCZBCLYQoXP: -0.01000000 Waves
2023.05.22 14:23 [3654612] smart account 3P6QCup9ZgsBg8LLzk7dCa8MnCZBCLYQoXP > SELF 0.00000000 Waves
{
"type": 13,
"id": "HYXMZQVk1TtVcYjtyUoYn3wBq7YNX6nM5rme1QFV7ejr",
"fee": 1000000,
"feeAssetId": null,
"timestamp": 1684754590075,
"version": 2,
"chainId": 87,
"sender": "3P6QCup9ZgsBg8LLzk7dCa8MnCZBCLYQoXP",
"senderPublicKey": "Gz4W9Y9UMEEZzMBu6GHyXY7BRsLXdbzFDwRPak18TW7u",
"proofs": [
"3w1zayRtixiHbxSPs9NXfbnYjqB3yRFTAVtnMnCW33CMR79zDYg2HBJWpsmUWJ2X8nJr5d3cfenM4ZMLKNdsaetx"
],
"script": "base64:BgIGCAISABIABAAIeHRuYXB5SWQBIFo7IE7afJx8sjIhsNqLuRLbzygBZVEzKYrJUwgG7dMSAAV4dG5JZAEgtiYpwwT1zlORpA5LdSQvZIxRsfrfr1QpvUjSHSqyqtEBEGNoZWNrQmxvY2tIZWlnaHQABQZoZWlnaHQABHJhdGUJAGQCCQBpAgkAaQIJAGkCCQBoAgkAZQIJARBjaGVja0Jsb2NrSGVpZ2h0AACf+74BAAUAZADtAgCgCwABAgFpAQhzdGFrZVhUTgAEA3BtdAkBBXZhbHVlAQkAkQMCCAUBaQhwYXltZW50cwAABAZhbW91bnQJAGkCCAUDcG10BmFtb3VudAUEcmF0ZQMJAQIhPQIIBQNwbXQHYXNzZXRJZAUFeHRuSWQJAAIBAhVhdHRhY2ggWFROIHRva2VuIG9ubHkEC3h0bmFweUlzc3VlCQEHUmVpc3N1ZQMFCHh0bmFweUlkBQZhbW91bnQGCQDMCAIFC3h0bmFweUlzc3VlCQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMIBQFpBmNhbGxlcgUGYW1vdW50BQh4dG5hcHlJZAUDbmlsAWkBCnVuc3Rha2VYVE4ABANwbXQJAQV2YWx1ZQEJAJEDAggFAWkIcGF5bWVudHMAAAQGYW1vdW50CQBoAggFA3BtdAZhbW91bnQFBHJhdGUDCQECIT0CCAUDcG10B2Fzc2V0SWQFCHh0bmFweUlkCQACAQIYYXR0YWNoIFhUTkFQWSB0b2tlbiBvbmx5BAp4dG5hcHlCdXJuCQEEQnVybgIFCHh0bmFweUlkBQZhbW91bnQJAMwIAgUKeHRuYXB5QnVybgkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDCAUBaQZjYWxsZXIFBmFtb3VudAUFeHRuSWQFA25pbAD0ICgx",
"height": 3654612,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: DRx3xE6qyPtS6K233RsJYRwryo3h6zWYYz85Z9TkYZuK
Next: 6edFGH3QokYot1WqFe5qwrGYuF3S7oqPfjeGFJ7YMa8Z
Diff:
Old | New | | Differences |
---|
5 | 5 | | |
---|
6 | 6 | | let xtnId = base58'DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p' |
---|
7 | 7 | | |
---|
8 | | - | let APY = (1 + (((((height - 3128735) * 5) / 100) / 365) / 1440)) |
---|
| 8 | + | func checkBlockHeight () = height |
---|
| 9 | + | |
---|
| 10 | + | |
---|
| 11 | + | let rate = ((((((checkBlockHeight() - 3128735) * 5) / 100) / 365) / 1440) + 1) |
---|
9 | 12 | | |
---|
10 | 13 | | @Callable(i) |
---|
11 | 14 | | func stakeXTN () = { |
---|
12 | 15 | | let pmt = value(i.payments[0]) |
---|
13 | | - | let amount = (pmt.amount / APY) |
---|
| 16 | + | let amount = (pmt.amount / rate) |
---|
14 | 17 | | if ((pmt.assetId != xtnId)) |
---|
15 | 18 | | then throw("attach XTN token only") |
---|
16 | 19 | | else { |
---|
17 | | - | let lockInv = invoke(Address(base58'3P4uA5etnZi4AmBabKinq2bMiWU8KcnHZdH'), "supply", nil, [pmt]) |
---|
18 | | - | if ((lockInv == lockInv)) |
---|
19 | | - | then { |
---|
20 | | - | let xtnapyIssue = Reissue(xtnapyId, amount, true) |
---|
| 20 | + | let xtnapyIssue = Reissue(xtnapyId, amount, true) |
---|
21 | 21 | | [xtnapyIssue, ScriptTransfer(i.caller, amount, xtnapyId)] |
---|
22 | | - | } |
---|
23 | | - | else throw("Strict value is not equal to itself.") |
---|
24 | 22 | | } |
---|
25 | 23 | | } |
---|
26 | 24 | | |
---|
|
29 | 27 | | @Callable(i) |
---|
30 | 28 | | func unstakeXTN () = { |
---|
31 | 29 | | let pmt = value(i.payments[0]) |
---|
32 | | - | let amount = pmt.amount |
---|
| 30 | + | let amount = (pmt.amount * rate) |
---|
33 | 31 | | if ((pmt.assetId != xtnapyId)) |
---|
34 | 32 | | then throw("attach XTNAPY token only") |
---|
35 | 33 | | else { |
---|
36 | | - | let lockInv = invoke(Address(base58'3P4uA5etnZi4AmBabKinq2bMiWU8KcnHZdH'), "withdraw", [xtnId, amount], [pmt]) |
---|
37 | | - | if ((lockInv == lockInv)) |
---|
38 | | - | then { |
---|
39 | | - | let xtnapyBurn = Burn(xtnapyId, amount) |
---|
40 | | - | [xtnapyBurn, ScriptTransfer(i.caller, (amount * APY), xtnId)] |
---|
41 | | - | } |
---|
42 | | - | else throw("Strict value is not equal to itself.") |
---|
| 34 | + | let xtnapyBurn = Burn(xtnapyId, amount) |
---|
| 35 | + | [xtnapyBurn, ScriptTransfer(i.caller, amount, xtnId)] |
---|
43 | 36 | | } |
---|
44 | 37 | | } |
---|
45 | 38 | | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 6 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let xtnapyId = base58'75Dz6E9vHi3gcmLvA4DesPRC7QmWaGK1ZR2uAGEXmrPK' |
---|
5 | 5 | | |
---|
6 | 6 | | let xtnId = base58'DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p' |
---|
7 | 7 | | |
---|
8 | | - | let APY = (1 + (((((height - 3128735) * 5) / 100) / 365) / 1440)) |
---|
| 8 | + | func checkBlockHeight () = height |
---|
| 9 | + | |
---|
| 10 | + | |
---|
| 11 | + | let rate = ((((((checkBlockHeight() - 3128735) * 5) / 100) / 365) / 1440) + 1) |
---|
9 | 12 | | |
---|
10 | 13 | | @Callable(i) |
---|
11 | 14 | | func stakeXTN () = { |
---|
12 | 15 | | let pmt = value(i.payments[0]) |
---|
13 | | - | let amount = (pmt.amount / APY) |
---|
| 16 | + | let amount = (pmt.amount / rate) |
---|
14 | 17 | | if ((pmt.assetId != xtnId)) |
---|
15 | 18 | | then throw("attach XTN token only") |
---|
16 | 19 | | else { |
---|
17 | | - | let lockInv = invoke(Address(base58'3P4uA5etnZi4AmBabKinq2bMiWU8KcnHZdH'), "supply", nil, [pmt]) |
---|
18 | | - | if ((lockInv == lockInv)) |
---|
19 | | - | then { |
---|
20 | | - | let xtnapyIssue = Reissue(xtnapyId, amount, true) |
---|
| 20 | + | let xtnapyIssue = Reissue(xtnapyId, amount, true) |
---|
21 | 21 | | [xtnapyIssue, ScriptTransfer(i.caller, amount, xtnapyId)] |
---|
22 | | - | } |
---|
23 | | - | else throw("Strict value is not equal to itself.") |
---|
24 | 22 | | } |
---|
25 | 23 | | } |
---|
26 | 24 | | |
---|
27 | 25 | | |
---|
28 | 26 | | |
---|
29 | 27 | | @Callable(i) |
---|
30 | 28 | | func unstakeXTN () = { |
---|
31 | 29 | | let pmt = value(i.payments[0]) |
---|
32 | | - | let amount = pmt.amount |
---|
| 30 | + | let amount = (pmt.amount * rate) |
---|
33 | 31 | | if ((pmt.assetId != xtnapyId)) |
---|
34 | 32 | | then throw("attach XTNAPY token only") |
---|
35 | 33 | | else { |
---|
36 | | - | let lockInv = invoke(Address(base58'3P4uA5etnZi4AmBabKinq2bMiWU8KcnHZdH'), "withdraw", [xtnId, amount], [pmt]) |
---|
37 | | - | if ((lockInv == lockInv)) |
---|
38 | | - | then { |
---|
39 | | - | let xtnapyBurn = Burn(xtnapyId, amount) |
---|
40 | | - | [xtnapyBurn, ScriptTransfer(i.caller, (amount * APY), xtnId)] |
---|
41 | | - | } |
---|
42 | | - | else throw("Strict value is not equal to itself.") |
---|
| 34 | + | let xtnapyBurn = Burn(xtnapyId, amount) |
---|
| 35 | + | [xtnapyBurn, ScriptTransfer(i.caller, amount, xtnId)] |
---|
43 | 36 | | } |
---|
44 | 37 | | } |
---|
45 | 38 | | |
---|
46 | 39 | | |
---|