tx · 82QTVuYdDdcBQRVWGqbuoUk3o5hNAeGN7vKFb4nZ3pEG

3MyDGEoKp1gF4LSRknk9vSuDEyrwuYXcQEQ:  -0.01000000 Waves

2022.05.11 16:20 [2047061] smart account 3MyDGEoKp1gF4LSRknk9vSuDEyrwuYXcQEQ > SELF 0.00000000 Waves

{ "type": 13, "id": "82QTVuYdDdcBQRVWGqbuoUk3o5hNAeGN7vKFb4nZ3pEG", "fee": 1000000, "feeAssetId": null, "timestamp": 1652275299478, "version": 2, "chainId": 84, "sender": "3MyDGEoKp1gF4LSRknk9vSuDEyrwuYXcQEQ", "senderPublicKey": "BhRnrwd6wVHSkSaWXCjQRjaoXcpCdUW2hkJD6V7uVDxN", "proofs": [ "2PyKfr9zait2zNhhHMiveF9hcH1fLNz4NFYAU2RyPWJ8yXHPt3FtHqzkfSCyCrD2F4D9g1DVCfYv3CkfC7cDBXjM" ], "script": "base64:AAIFAAAAAAAAADYIAhIAEgQKAggBEgMKAQESBQoDCAgBEgQKAggBEgQKAggBEgASBAoCCAESBAoCCAESBAoCCAEAAAAMAAAAAApzaGlueXdnZ2lkAQAAACCJac8C/7a6udRxltd5uJl2JrB00Hd59HNuhvD0c58GJgAAAAAMYWRtaW5BZGRyZXNzCQEAAAARQGV4dHJOYXRpdmUoMTA2MikAAAABAgAAACMzTXBOdGlQU1JTcTZObmFRWWszOEJmV1N6WmNnQVlUeXJROQAAAAANYXNzZXRzQWRkcmVzcwEAAAAaAVTL5rTBd9cdJy1rFhBLypFI6ymLChqVp5oAAAAADm5hdGlvbnNBZGRyZXNzAQAAABoBVE2F6N70+ERrWRA7cF/Dt7llDlH1REZtoAEAAAANdHJ5R2V0SW50ZWdlcgAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFiBQAAAAckbWF0Y2gwBQAAAAFiAAAAAAAAAAAAAQAAAA10cnlHZX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atus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 71MsKjrx7rDqJ9qwAxhKeY59D7SuaycTWjPuHvBz2e57 Next: 5A6T118BKsE1cgCirdCjgbpXvEQctyqoTynXcath5y4X Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let shinywggid = base58'AFQS5E4ELtxex3iANtWtUU2V2oWJZSo8VVnK8z3VFmqf'
55
66 let adminAddress = addressFromStringValue("3MpNtiPSRSq6NnaQYk38BfWSzZcgAYTyrQ9")
77
88 let assetsAddress = base58'3N8WDKbqGox5Eky326PHHT7rUyrby5MXdmb'
99
1010 let nationsAddress = base58'3MvyzDtzWWV5MZ1GP8JfQhhQqiGU4Nbifdy'
1111
1212 func tryGetInteger (key) = match getInteger(this, key) {
1313 case b: Int =>
1414 b
1515 case _ =>
1616 0
1717 }
1818
1919
2020 func tryGetBoolean (key) = match getBoolean(this, key) {
2121 case b: Boolean =>
2222 b
2323 case _ =>
2424 false
2525 }
2626
2727
2828 func getTreasuryKey (nationid) = (nationid + "_Treasury")
2929
3030
3131 func internalDeposit (addressStr,amountIn) = {
3232 let amount = tryGetInteger((addressStr + "_Deposit"))
3333 [IntegerEntry((addressStr + "_Deposit"), (amount + amountIn))]
3434 }
3535
3636
3737 func internalPay (addressStr,amount) = {
3838 let deposited = tryGetInteger((addressStr + "_Deposit"))
3939 if ((0 > (deposited - amount)))
4040 then throw("Not enough deposit.")
4141 else if (((deposited - amount) == 0))
4242 then [DeleteEntry((addressStr + "_Deposit"))]
4343 else [IntegerEntry((addressStr + "_Deposit"), (deposited - amount))]
4444 }
4545
4646
4747 func internalReserve (addressStr,amount) = {
4848 let reservedAmount = tryGetInteger((addressStr + "_Reserved"))
4949 [IntegerEntry((addressStr + "_Reserved"), (reservedAmount + amount))]
5050 }
5151
5252
5353 func internalTransfer (fromAddress,toAddress,amount) = (internalPay(fromAddress, amount) ++ internalDeposit(toAddress, amount))
5454
5555
5656 func checkAdmin (caller) = if (if (if ((caller == adminAddress))
5757 then true
5858 else (caller == this))
5959 then true
6060 else (caller.bytes == nationsAddress))
6161 then true
6262 else (caller.bytes == assetsAddress)
6363
6464
6565 @Callable(i)
6666 func Deposit () = {
6767 let addressStr = toString(i.originCaller)
6868 let pmt = i.payments[0]
6969 if ((pmt == pmt))
7070 then {
7171 let amountIn = value(i.payments[0].amount)
7272 if ((amountIn == amountIn))
7373 then {
7474 let assetIn = pmt.assetId
7575 if ((assetIn == assetIn))
7676 then if ((assetIn != shinywggid))
7777 then throw("Only $HEG payments allowed")
7878 else {
7979 let amount = tryGetInteger((addressStr + "_Deposit"))
8080 $Tuple2(internalDeposit(addressStr, (amount + amountIn)), (amount + amountIn))
8181 }
8282 else throw("Strict value is not equal to itself.")
8383 }
8484 else throw("Strict value is not equal to itself.")
8585 }
8686 else throw("Strict value is not equal to itself.")
8787 }
8888
8989
9090
9191 @Callable(i)
9292 func Pay (addressStr,amount) = if (!(checkAdmin(i.caller)))
9393 then throw("you are not authorized to perform this operation")
9494 else $Tuple2(internalPay(addressStr, amount), amount)
9595
9696
9797
9898 @Callable(i)
9999 func CallerPay (amount) = {
100100 let callerAddr = toString(i.caller)
101101 internalPay(callerAddr, amount)
102102 }
103103
104104
105105
106106 @Callable(i)
107107 func transferCoins (fromAddress,toAddress,amount) = if (if ((i.caller != adminAddress))
108108 then (i.caller.bytes != assetsAddress)
109109 else false)
110110 then throw("you are not authorized to perform this operation")
111111 else $Tuple2(internalTransfer(fromAddress, toAddress, amount), amount)
112112
113113
114114
115115 @Callable(i)
116116 func callerTransferCoins (toAddress,amount) = internalTransfer(toString(i.caller), toAddress, amount)
117117
118118
119119
120120 @Callable(i)
121121 func arbitraryAddCoins (toAddress,amount) = if (if (if ((i.caller != adminAddress))
122122 then (i.caller.bytes != assetsAddress)
123123 else false)
124124 then (i.caller.bytes != nationsAddress)
125125 else false)
126126 then throw("you are not authorized to perform this operation")
127127 else $Tuple2(internalDeposit(toAddress, amount), amount)
128128
129129
130130
131131 @Callable(i)
132132 func Redeem () = {
133133 let addressStr = toString(i.caller)
134134 let reservedAmount = tryGetInteger((addressStr + "_Reserved"))
135135 if ((reservedAmount == 0))
136136 then throw("Nothing to redeem")
137137 else [DeleteEntry((addressStr + "_Reserved")), ScriptTransfer(i.caller, reservedAmount, shinywggid)]
138138 }
139139
140140
141141
142142 @Callable(i)
143143 func addReward (addressStr,amount) = if (!(checkAdmin(i.caller)))
144144 then throw("you are not authorized to perform this operation")
145145 else {
146146 let reservedAmount = tryGetInteger((addressStr + "_Reserved"))
147147 $Tuple2([IntegerEntry((addressStr + "_Reserved"), (reservedAmount + amount))], (reservedAmount + amount))
148148 }
149149
150150
151151
152152 @Callable(i)
153153 func increaseNationWallet (NationKey,amount) = if (!(checkAdmin(i.caller)))
154154 then throw("you are not authorized to perform this operation")
155155 else {
156156 let key = getTreasuryKey(NationKey)
157157 let reservedAmount = tryGetInteger(key)
158158 $Tuple2([IntegerEntry(key, (reservedAmount + amount))], (reservedAmount + amount))
159159 }
160160
161161
162162
163163 @Callable(i)
164164 func decreaseNationWallet (NationKey,amount) = if (!(checkAdmin(i.caller)))
165165 then throw("you are not authorized to perform this operation")
166166 else {
167167 let key = getTreasuryKey(NationKey)
168168 let reservedAmount = tryGetInteger(key)
169169 $Tuple2([IntegerEntry(key, (reservedAmount - amount))], (reservedAmount - amount))
170170 }
171171
172172

github/deemru/w8io/169f3d6 
37.41 ms