tx · 47DVS1BTwVHjP6UCHaoReNBzpUkartzLr5gJ9WKexQrX 3NABuNeBpSvWZPDR8BN5jjSMLfMqXcodtM8: -0.01000000 Waves 2023.06.26 02:52 [2638851] smart account 3NABuNeBpSvWZPDR8BN5jjSMLfMqXcodtM8 > SELF 0.00000000 Waves
{ "type": 13, "id": "47DVS1BTwVHjP6UCHaoReNBzpUkartzLr5gJ9WKexQrX", "fee": 1000000, "feeAssetId": null, "timestamp": 1687737163998, "version": 2, "chainId": 84, "sender": "3NABuNeBpSvWZPDR8BN5jjSMLfMqXcodtM8", "senderPublicKey": "EYH5iFAFHoFTpSTn7zeh46Ao3BGNwPXNuRfMcfiGmoso", "proofs": [ "3bbQjTMMUKQ5MpkqDFLEtNrL8MSUF1bS7j9Cva9nYNsxDR7EFJ7uzjmR5M2mo68KihqfJ8wv9mnnLssrvSVsugGX" ], "script": "base64:BgIHCAISAwoBAQEBD2Ftb3VudEJ5QWRkcktleQEEYWRkcgkArAICAglsZWFzZUFtdF8FBGFkZHIBAWkBB3JlTGVhc2UBCW5ld0Ftb3VudAQEYWRkcgkApQgBCAUBaQZjYWxsZXIECWFkZEFtb3VudAMJAAACCQCQAwEIBQFpCHBheW1lbnRzAAAAAAMDCQAAAgkAkAMBCAUBaQhwYXltZW50cwABCQAAAggJAJEDAggFAWkIcGF5bWVudHMAAAdhc3NldElkBQR1bml0BwgJAJEDAggFAWkIcGF5bWVudHMAAAZhbW91bnQJAAIBAg1Xcm9uZyBwYXltZW50BA1vbGRVc2VyQW1vdW50CQELdmFsdWVPckVsc2UCCQCfCAEJAQ9hbW91bnRCeUFkZHJLZXkBBQRhZGRyAAAEC3RvdGFsQW1vdW50CQELdmFsdWVPckVsc2UCCQCfCAECDXRvdGFsTGVhc2VBbXQAAAQKdXNlckFtb3VudAMJAGYCBQlhZGRBbW91bnQAAAkAZAIFDW9sZFVzZXJBbW91bnQFCWFkZEFtb3VudAkAlwMBCQDMCAIFDW9sZFVzZXJBbW91bnQJAMwIAgUJbmV3QW1vdW50BQNuaWwED2RlbHRhVXNlckFtb3VudAkAZQIFCnVzZXJBbW91bnQFDW9sZFVzZXJBbW91bnQEBWxlYXNlCQDECAIJARFAZXh0ck5hdGl2ZSgxMDYyKQECETNQbm9kZUFkZHJlc3NIZXJlCQBkAgULdG90YWxBbW91bnQFD2RlbHRhVXNlckFtb3VudAQIb2xkTGVhc2UJAKEIAQIHbGVhc2VJZAMJAQlpc0RlZmluZWQBBQhvbGRMZWFzZQkAzAgCCQELTGVhc2VDYW5jZWwBCQEFdmFsdWUBBQhvbGRMZWFzZQUDbmlsCQDOCAIFA25pbAMJAGYCAAAFD2RlbHRhVXNlckFtb3VudAkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDCAUBaQZjYWxsZXIJAQEtAQUPZGVsdGFVc2VyQW1vdW50BQR1bml0BQNuaWwJAM4IAgUDbmlsCQDMCAIFBWxlYXNlCQDMCAIJAQtCaW5hcnlFbnRyeQICB2xlYXNlSWQJALkIAQUFbGVhc2UJAMwIAgkBDEludGVnZXJFbnRyeQICDXRvdGFsTGVhc2VBbXQJAGQCBQt0b3RhbEFtb3VudAUPZGVsdGFVc2VyQW1vdW50CQDMCAIJAQxJbnRlZ2VyRW50cnkCCQEPYW1vdW50QnlBZGRyS2V5AQUEYWRkcgUKdXNlckFtb3VudAUDbmlsABpykZQ=", "height": 2638851, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 33h2ZEy197kGiwtGx4AS4gznYk1sGKdtUFa4mhWTXLXW Next: J6TJbFreKzS8yZ2fhfEgHBFSaaex8biLg11VtgeHKtzj Full:
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION 5 #-} | |
2 | - | {-# CONTENT_TYPE EXPRESSION #-} | |
3 | - | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | func amountByAddrKey (addr) = ("leaseAmt_" + addr) | |
5 | + | ||
6 | + | ||
7 | + | @Callable(i) | |
8 | + | func reLease (newAmount) = { | |
9 | + | let addr = toString(i.caller) | |
10 | + | let addAmount = if ((size(i.payments) == 0)) | |
11 | + | then 0 | |
12 | + | else if (if ((size(i.payments) == 1)) | |
13 | + | then (i.payments[0].assetId == unit) | |
14 | + | else false) | |
15 | + | then i.payments[0].amount | |
16 | + | else throw("Wrong payment") | |
17 | + | let oldUserAmount = valueOrElse(getInteger(amountByAddrKey(addr)), 0) | |
18 | + | let totalAmount = valueOrElse(getInteger("totalLeaseAmt"), 0) | |
19 | + | let userAmount = if ((addAmount > 0)) | |
20 | + | then (oldUserAmount + addAmount) | |
21 | + | else min([oldUserAmount, newAmount]) | |
22 | + | let deltaUserAmount = (userAmount - oldUserAmount) | |
23 | + | let lease = Lease(addressFromStringValue("3PnodeAddressHere"), (totalAmount + deltaUserAmount)) | |
24 | + | let oldLease = getBinary("leaseId") | |
25 | + | if (isDefined(oldLease)) | |
26 | + | then [LeaseCancel(value(oldLease))] | |
27 | + | else (nil ++ (if ((0 > deltaUserAmount)) | |
28 | + | then [ScriptTransfer(i.caller, -(deltaUserAmount), unit)] | |
29 | + | else (nil ++ [lease, BinaryEntry("leaseId", calculateLeaseId(lease)), IntegerEntry("totalLeaseAmt", (totalAmount + deltaUserAmount)), IntegerEntry(amountByAddrKey(addr), userAmount)]))) | |
30 | + | } | |
31 | + | ||
32 | + |
github/deemru/w8io/169f3d6 19.81 ms ◑