tx · 83nW6mycVe8FA12XDrkzeUJ15jPmb8XpMzcoBPpWeE47 3Mzc1EHokLPuguwwpKW9retTD9JvM8abaPP: -0.01000000 Waves 2022.03.17 10:00 [1967609] smart account 3Mzc1EHokLPuguwwpKW9retTD9JvM8abaPP > SELF 0.00000000 Waves
{ "type": 13, "id": "83nW6mycVe8FA12XDrkzeUJ15jPmb8XpMzcoBPpWeE47", "fee": 1000000, "feeAssetId": null, "timestamp": 1647500460155, "version": 2, "chainId": 84, "sender": "3Mzc1EHokLPuguwwpKW9retTD9JvM8abaPP", "senderPublicKey": "28pMascxqpomJpGXBUtXAGDmKJFMdTTYvq5KPUuY1DGD", "proofs": [ "4w8Hr6PChGCZuGihGpupNhZJqfwij675njncoCaQnCpWUqKNeD1YLJRKaqLxaW5fcPjosMcEgYQEdXVxPG4eWcEs" ], "script": "base64:AAIFAAAAAAAAAAQIAhIAAAAAAwAAAAAEdXNkTgEAAAAAAAAAAAxleGNoYW5nZVJhdGUAAAAAAAAAAAUAAAAABnN0YWtlcgkBAAAAB0FkZHJlc3MAAAABAQAAAAAAAAABAAAAAWkBAAAAEWV4Y2hhbmdlV2F2ZXNVc2ROAAAAAAMJAQAAAAIhPQAAAAIICQABkQAAAAIIBQAAAAFpAAAACHBheW1lbnRzAAAAAAAAAAAAAAAAB2Fzc2V0SWQFAAAABHVuaXQJAAACAAAAAQIAAAAQdW5leHBlY3RlZCBhc3NldAQAAAABcgkAA/wAAAAEBQAAAAZzdGFrZXICAAAAC2NhbmNlbFN0YWtlCQAETAAAAAIJAABoAAAAAggJAAGRAAAAAggFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAAAAAAGYW1vdW50BQAAAAxleGNoYW5nZVJhdGUFAAAAA25pbAUAAAADbmlsAwkAAAAAAAACBQAAAAFyBQAAAAFyCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgkAAGgAAAACCAkAAZEAAAACCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAAAAAAZhbW91bnQFAAAADGV4Y2hhbmdlUmF0ZQUAAAAEdXNkTgUAAAADbmlsCQAAAgAAAAECAAAAJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgAAAACxJx+i", "height": 1967609, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GvSnWxQc1C7bCGuuPUeRb9a99dVMCrTyY7NbHjDCBDD5 Next: J27EpaY7vycy3opjrgh8TZ4F3QubpoHaJVoxX644VCDJ Full:
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let | |
4 | + | let usdN = base58'' | |
5 | 5 | ||
6 | - | let | |
6 | + | let exchangeRate = 5 | |
7 | 7 | ||
8 | - | func getAnswer (question,previousAnswer) = { | |
9 | - | let hash = sha256(toBytes((question + previousAnswer))) | |
10 | - | let index = toInt(hash) | |
11 | - | answers[(index % answersCount)] | |
12 | - | } | |
13 | - | ||
14 | - | ||
15 | - | func getPreviousAnswer (address) = match getString(this, (address + "_a")) { | |
16 | - | case a: String => | |
17 | - | a | |
18 | - | case _ => | |
19 | - | address | |
20 | - | } | |
21 | - | ||
8 | + | let staker = Address(base58'') | |
22 | 9 | ||
23 | 10 | @Callable(i) | |
24 | - | func tellme (question) = { | |
25 | - | let callerAddress = toBase58String(i.caller.bytes) | |
26 | - | let answer = getAnswer(question, getPreviousAnswer(callerAddress)) | |
27 | - | WriteSet([DataEntry((callerAddress + "3Mzc1EHokLPuguwwpKW9retTD9JvM8abaPP_q"), question), DataEntry((callerAddress + "3Mzc1EHokLPuguwwpKW9retTD9JvM8abaPP_a"), answer)]) | |
28 | - | } | |
11 | + | func exchangeWavesUsdN () = if ((i.payments[0].assetId != unit)) | |
12 | + | then throw("unexpected asset") | |
13 | + | else { | |
14 | + | let r = invoke(staker, "cancelStake", [(i.payments[0].amount * exchangeRate)], nil) | |
15 | + | if ((r == r)) | |
16 | + | then [ScriptTransfer(i.caller, (i.payments[0].amount * exchangeRate), usdN)] | |
17 | + | else throw("Strict value is not equal to itself.") | |
18 | + | } | |
29 | 19 | ||
30 | 20 |
github/deemru/w8io/026f985 31.71 ms ◑