tx · 2ZACk6Q92aY5sDKH3xZk6VAey3o1ch3FFb2kFU1DtSgt

3Mt4pmCGGRuWGuNy3pyyRij45rySapd44Mw:  -0.01000000 Waves

2022.05.05 19:34 [2038642] smart account 3Mt4pmCGGRuWGuNy3pyyRij45rySapd44Mw > SELF 0.00000000 Waves

{ "type": 13, "id": "2ZACk6Q92aY5sDKH3xZk6VAey3o1ch3FFb2kFU1DtSgt", "fee": 1000000, "feeAssetId": null, "timestamp": 1651768531679, "version": 2, "chainId": 84, "sender": "3Mt4pmCGGRuWGuNy3pyyRij45rySapd44Mw", "senderPublicKey": "88pVWRX5DjU6wHFa5a8qeFQ3fuykBy1BXq7Z8pjdxhsc", "proofs": [ "5gRntVNjmocLH2476gujv8W7drPCzuBnMoVmat8qfWRZYKCbQojL1CnEUA6ujTSFhk7AgdhFPq4JjJHYyKEmqQ2k" ], "script": "base64:AAIDAAAAAAAAATsIARIAEgAaBgoBYRIBaRoQCgFiEgtTdGFrZWRUb2tlbhoICgFjEgNwbXQaFwoBZBISVXNlclN0YWtlZFRva2VuS2V5GhcKAWUSElVzZXJHb3Zlcm5Ub2tlbktleRoXCgFmEhJVc2VyTGFzdFN0YWtlQmxvY2saHQoBZxIYY3VycmVudEFtb3VudFN0YWtlZFRva2VuGgwKAWgSByRtYXRjaDAaBgoBaRIBYRoZCgFqEhRuZXdBbW91bnRTdGFrZWRUb2tlbhofCgFrEhpDb250cmFjdFdhbGxldFN0YWtlQmFsYW5jZRoQCgFsEgtBY3R1YWxEZWxheRocCgFtEhdVc2VyTGFzdFN0YWtlQmxvY2tWYWx1ZRoPCgFuEgpjdXJyZW50S2V5GhIKAW8SDWN1cnJlbnRBbW91bnQAAAAAAAAAAgAAAAFhAQAAAAVTdGFrZQAAAAAEAAAAAWIBAAAAIDuWMw0Cl6r3boWUBaO2GhLrBr0cYVyuuqg+TPg3fGFFBAAAAAFjCQEAAAAHZXh0cmFjdAAAAAEIBQAAAAFhAAAAB3BheW1lbnQDAwkAAGYA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AFtBAAAAAFoCQAEGgAAAAIFAAAABHRoaXMFAAAAAWYDCQAAAQAAAAIFAAAAAWgCAAAAA0ludAQAAAABaQUAAAABaAUAAAABaQAAAAAAAAAAAAQAAAABbgkAAlgAAAABCAgFAAAAAWEAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAAFvBAAAAAFoCQAEGgAAAAIFAAAABHRoaXMFAAAAAWQDCQAAAQAAAAIFAAAAAWgCAAAAA0ludAQAAAABaQUAAAABaAUAAAABaQAAAAAAAAAAAAMJAABmAAAAAgAAAAAAAAAAAAUAAAABbwkAAAIAAAABAgAAAB5DYW4ndCB3aXRoZHJhdyBuZWdhdGl2ZSBhbW91bnQDCQAAZgAAAAIAAAAAAAAAAAAFAAAAAW8JAAACAAAAAQkAASwAAAACAgAAAEFVc2VyIGNhbm5vdCB3aXRoZHJhdyBtb3JlIHRoYW4gZGVwb3NpdGVkIGZ1bmRzLCBZb3VyIGRlcG9zaXQgaXM6IAkAAaQAAAABCQAAaQAAAAIFAAAAAW8AAAAAAAX14QADCQAAZgAAAAIJAABkAAAAAgUAAAABbQUAAAABbAUAAAAGaGVpZ2h0CQEAAAAMU2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAABZAUAAAABbwkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAABZgAAAAAAAAAAAAUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFhAAAABmNhbGxlcgUAAAABbwUAAAABYgUAAAADbmlsCQAAAgAAAAEJAAEsAAAAAgIAAAAqQ2Fubm90IHVuc3Rha2UgYmVmb3JlIHRoZSBtaW5pbXVtIHBlcmlvZDogCQABpAAAAAEFAAAAAWwAAAAAeg8+Kw==", "height": 2038642, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: AqxJ4u6KLXSx265bKFU6AJBpH8Ab8ZiEFZpxQeRL86UL Next: GzhR8NLsR8q5iyotfuQbrgSTYxzUSvSwWUMPVSvS1Dav Diff:
OldNewDifferences
3030
3131
3232 @Callable(i)
33-func WithdrawStakedFunds (amount) = {
33+func WithdrawStakedFunds () = {
3434 let StakedToken = base58'51bthK9ab3y4G4gj88qeoQ4XuYM2ex2hape7yc6QzAyS'
3535 let UserLastStakeBlock = (toBase58String(i.caller.bytes) + "_UserLastStakeBlock")
3636 let UserStakedTokenKey = (toBase58String(i.caller.bytes) + "_Staking")
4848 case _ =>
4949 0
5050 }
51- let newAmount = (currentAmount - amount)
52- if ((0 > amount))
51+ if ((0 > currentAmount))
5352 then throw("Can't withdraw negative amount")
54- else if ((0 > newAmount))
53+ else if ((0 > currentAmount))
5554 then throw(("User cannot withdraw more than deposited funds, Your deposit is: " + toString((currentAmount / 100000000))))
5655 else if (((UserLastStakeBlockValue + ActualDelay) > height))
57- then ScriptResult(WriteSet([DataEntry(UserStakedTokenKey, newAmount), DataEntry(UserLastStakeBlock, 0)]), TransferSet([ScriptTransfer(i.caller, amount, StakedToken)]))
56+ then ScriptResult(WriteSet([DataEntry(UserStakedTokenKey, currentAmount), DataEntry(UserLastStakeBlock, 0)]), TransferSet([ScriptTransfer(i.caller, currentAmount, StakedToken)]))
5857 else throw(("Cannot unstake before the minimum period: " + toString(ActualDelay)))
5958 }
6059
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44
55
66 @Callable(i)
77 func Stake () = {
88 let StakedToken = base58'51bthK9ab3y4G4gj88qeoQ4XuYM2ex2hape7yc6QzAyS'
99 let pmt = extract(i.payment)
1010 if (if ((pmt.amount > 0))
1111 then (pmt.assetId == StakedToken)
1212 else false)
1313 then {
1414 let UserStakedTokenKey = (toBase58String(i.caller.bytes) + "_Stake")
1515 let UserGovernTokenKey = (toBase58String(i.caller.bytes) + "_Earnings")
1616 let UserLastStakeBlock = (toBase58String(i.caller.bytes) + "_UserLastStakeBlock")
1717 let currentAmountStakedToken = match getInteger(this, UserStakedTokenKey) {
1818 case a: Int =>
1919 a
2020 case _ =>
2121 0
2222 }
2323 let newAmountStakedToken = (currentAmountStakedToken + pmt.amount)
2424 let ContractWalletStakeBalance = assetBalance(this, StakedToken)
2525 WriteSet([DataEntry(UserStakedTokenKey, newAmountStakedToken), DataEntry(UserLastStakeBlock, height)])
2626 }
2727 else throw("Can deposit only StakeToken")
2828 }
2929
3030
3131
3232 @Callable(i)
33-func WithdrawStakedFunds (amount) = {
33+func WithdrawStakedFunds () = {
3434 let StakedToken = base58'51bthK9ab3y4G4gj88qeoQ4XuYM2ex2hape7yc6QzAyS'
3535 let UserLastStakeBlock = (toBase58String(i.caller.bytes) + "_UserLastStakeBlock")
3636 let UserStakedTokenKey = (toBase58String(i.caller.bytes) + "_Staking")
3737 let ActualDelay = (1440 * 7)
3838 let UserLastStakeBlockValue = match getInteger(this, UserLastStakeBlock) {
3939 case a: Int =>
4040 a
4141 case _ =>
4242 0
4343 }
4444 let currentKey = toBase58String(i.caller.bytes)
4545 let currentAmount = match getInteger(this, UserStakedTokenKey) {
4646 case a: Int =>
4747 a
4848 case _ =>
4949 0
5050 }
51- let newAmount = (currentAmount - amount)
52- if ((0 > amount))
51+ if ((0 > currentAmount))
5352 then throw("Can't withdraw negative amount")
54- else if ((0 > newAmount))
53+ else if ((0 > currentAmount))
5554 then throw(("User cannot withdraw more than deposited funds, Your deposit is: " + toString((currentAmount / 100000000))))
5655 else if (((UserLastStakeBlockValue + ActualDelay) > height))
57- then ScriptResult(WriteSet([DataEntry(UserStakedTokenKey, newAmount), DataEntry(UserLastStakeBlock, 0)]), TransferSet([ScriptTransfer(i.caller, amount, StakedToken)]))
56+ then ScriptResult(WriteSet([DataEntry(UserStakedTokenKey, currentAmount), DataEntry(UserLastStakeBlock, 0)]), TransferSet([ScriptTransfer(i.caller, currentAmount, StakedToken)]))
5857 else throw(("Cannot unstake before the minimum period: " + toString(ActualDelay)))
5958 }
6059
6160

github/deemru/w8io/026f985 
42.52 ms