tx · H1itMcQrnno3MgwxwkeD2oSusuYcVskDZvwrT8G334zp

3N8bfBHf85mChgxdRoTj11XEHHREfQmz6dw:  -0.01000000 Waves

2023.03.13 01:18 [2487407] smart account 3N8bfBHf85mChgxdRoTj11XEHHREfQmz6dw > SELF 0.00000000 Waves

{ "type": 13, "id": "H1itMcQrnno3MgwxwkeD2oSusuYcVskDZvwrT8G334zp", "fee": 1000000, "feeAssetId": null, "timestamp": 1678659567724, "version": 2, "chainId": 84, "sender": "3N8bfBHf85mChgxdRoTj11XEHHREfQmz6dw", "senderPublicKey": "6G9zJtFnV938b3kA2t6HebP8i69A1NMGVQ5qQ78fF1FR", "proofs": [ "4FbRXdYUKEcCDQwZt8FNn3UH86Kx7pbVZATmBUZhzTTDrJnfGTPqLRLsAPN4fTbg6oegcytxF2B7VUc2bQep9VXz" ], "script": "base64:AAIFAAAAAAAAACEIAhILCgkBAQEBCAgICAESABIAEgUKAwEICBIFCgMBAQEAAAAVAAAAAAJwcwIAAAANUFJFU0FMRV9TVEFSVAAAAAACcGQCAAAAEFBSRVNBTEVfRFVSQVRJT04AAAAAAmNzAgAAAAtDTEFJTV9TVEFSVAAAAAACY2QCAAAADkNMQUlNX0RVUkFUSU9OAAAAAAFwAgAAAAlQUklDRV9JRE8AAAAABHAxSUQCAAAAEFBSSUNFXzFfQVNTRVRfSUQAAAAACmFkbWluRXJyb3ICAAAALk9ubHkgdGhlIEFkbWluIGl0c2VsZiBjYW4gaW52b2tlIHRoaXMgZnVuY3Rpb24AAAAABHAySUQCAAAAEFBSSUNFXzJfQVNTRVRfSUQAAAAABHAzSUQCAAAAEFBSSUNFXzNfQVNTRVRfSUQAAAAABHA0SUQCAAAAEFBSSUNFXzRfQVNTRVRfSUQAAAAAA21pYQIAAAARTUlOX0FNT1VOVF9JTlZFU1QAAAAABW1haW5hAgAAAApNQUlOX0FTU0VUAAAAAAdmb3JTYWxlAgAAAA5UT1RBTF9GT1JfU0FMRQAAAAAJdG90YWxTYWxlAgAA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5zZmVyAAAAAwkBAAAAB0FkZHJlc3MAAAABCQACWQAAAAEFAAAAB2FkZHJlc3MFAAAABVZhbHVlCQACWQAAAAEFAAAAB2Fzc2V0SWQFAAAAA25pbAkAAAIAAAABBQAAAAphZG1pbkVycm9yAAAAAWkBAAAABHRpbWUAAAADAAAADHByZXNhbGVTdGFydAAAAA9wcmVzYWxlRHVyYXRpb24AAAAUZGlzdHJpYnV0aW9uRHVyYXRpb24DAwkAAAAAAAACCAUAAAABaQAAAAZjYWxsZXIFAAAABHRoaXMGCQAAAAAAAAIICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMJAQAAABFAZXh0ck5hdGl2ZSgxMDUyKQAAAAIFAAAABHRoaXMCAAAABWFkbWluAwkAAGcAAAACBQAAAA9wcmVzYWxlRHVyYXRpb24FAAAADHByZXNhbGVTdGFydAkAAAIAAAABAgAAADJQcmVzYWxlRHVyYXRpb24gY2FuJ3QgYmUgYmlnZ2VyIHRoYW4gIFByZXNhbGVTdGFydAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgUAAAACcHMFAAAADHByZXNhbGVTdGFydAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgUAAAACcGQFAAAAD3ByZXNhbGVEdXJhdGlvbgkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgUAAAAFZGlzZHUFAAAAFGRpc3RyaWJ1dGlvbkR1cmF0aW9uBQAAAANuaWwJAAACAAAAAQUAAAAKYWRtaW5FcnJvcgAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5/t8I4w==", "height": 2487407, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CCrAQ5bCAk2aqe2kCFbvB2dcnjXD3yQKd6nH2NeE27Py Next: 2zAEnCMo4o9pQEm57rHWbZwV4pM2mF7PnUxD1L1hx8hS Diff:
OldNewDifferences
4040 func getAssetIfValid (assetId) = toBase58String(valueOrErrorMessage(value(assetInfo(fromBase58String(assetId))).id, (("Asset Id: " + assetId) + " is invalid.")))
4141
4242
43-let adminAddress = "3N8UaqrCTjypGPWXSvFJVSLv23bfuiPoJAh"
43+let adminAddress = "3N1io5kDA3VhQyxrLyXtGaeLxoPtZfkAgEc"
4444
4545 let Admin = Address(fromBase58String(adminAddress))
4646
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let ps = "PRESALE_START"
55
66 let pd = "PRESALE_DURATION"
77
88 let cs = "CLAIM_START"
99
1010 let cd = "CLAIM_DURATION"
1111
1212 let p = "PRICE_IDO"
1313
1414 let p1ID = "PRICE_1_ASSET_ID"
1515
1616 let adminError = "Only the Admin itself can invoke this function"
1717
1818 let p2ID = "PRICE_2_ASSET_ID"
1919
2020 let p3ID = "PRICE_3_ASSET_ID"
2121
2222 let p4ID = "PRICE_4_ASSET_ID"
2323
2424 let mia = "MIN_AMOUNT_INVEST"
2525
2626 let maina = "MAIN_ASSET"
2727
2828 let forSale = "TOTAL_FOR_SALE"
2929
3030 let totalSale = "TOTAL_SALE"
3131
3232 let tinvest = "TOTAL_INVEST_"
3333
3434 let disdu = "DISTRIBUTION_DURATION"
3535
3636 let D8 = 100000000
3737
3838 let D10 = 10000000000
3939
4040 func getAssetIfValid (assetId) = toBase58String(valueOrErrorMessage(value(assetInfo(fromBase58String(assetId))).id, (("Asset Id: " + assetId) + " is invalid.")))
4141
4242
43-let adminAddress = "3N8UaqrCTjypGPWXSvFJVSLv23bfuiPoJAh"
43+let adminAddress = "3N1io5kDA3VhQyxrLyXtGaeLxoPtZfkAgEc"
4444
4545 let Admin = Address(fromBase58String(adminAddress))
4646
4747 @Callable(i)
4848 func constructor (presaleStart,presaleDuration,distributionDuration,price,price1AssetId58,price2AssetId58,price3AssetId58,price4AssetId58,minInvestAmount) = {
4949 let asset1 = getAssetIfValid(price1AssetId58)
5050 let asset2 = getAssetIfValid(price2AssetId58)
5151 let asset3 = getAssetIfValid(price3AssetId58)
5252 if (if ((i.caller == this))
5353 then true
5454 else (i.caller.bytes == getBinaryValue(Admin, "admin")))
5555 then if ((presaleDuration >= presaleStart))
5656 then throw("PresaleDuration can't be bigger than PresaleStart")
5757 else if ((minInvestAmount > price))
5858 then throw("minInvestAmount can't be bigger than price")
5959 else if (if (if ((asset1 == asset2))
6060 then true
6161 else (asset1 == asset3))
6262 then true
6363 else (asset2 == asset3))
6464 then throw("Each Asset must be different from the other.")
6565 else [StringEntry(p1ID, price1AssetId58), StringEntry(p2ID, price2AssetId58), StringEntry(p3ID, price3AssetId58), StringEntry(p4ID, price4AssetId58), IntegerEntry(ps, presaleStart), IntegerEntry(pd, presaleDuration), IntegerEntry(p, price), IntegerEntry(mia, minInvestAmount), IntegerEntry(totalSale, 0), IntegerEntry(disdu, distributionDuration)]
6666 else throw(adminError)
6767 }
6868
6969
7070
7171 @Callable(i)
7272 func set () = if (if ((i.caller == this))
7373 then true
7474 else (i.caller.bytes == getBinaryValue(Admin, "admin")))
7575 then if ((size(i.payments) != 1))
7676 then throw("exactly 1 payment must be attached")
7777 else [IntegerEntry(forSale, value(i.payments[0]).amount), BinaryEntry(maina, value(i.payments[0].assetId))]
7878 else throw(adminError)
7979
8080
8181
8282 @Callable(i)
8383 func invest () = {
8484 let mainAsset = getBinaryValue(this, maina)
8585 let presaleStart = getIntegerValue(this, ps)
8686 let presaleDuration = getIntegerValue(this, pd)
8787 let presaleEnd = (presaleStart + presaleDuration)
8888 let price = getIntegerValue(this, p)
8989 let h = height
9090 let pmt = value(i.payments[0])
9191 let pmtAssetId = toBase58String(value(pmt.assetId))
9292 let pmtAmount = pmt.amount
9393 let asset1 = getStringValue(this, p1ID)
9494 let asset2 = getStringValue(this, p2ID)
9595 let asset3 = getStringValue(this, p3ID)
9696 let asset4 = getStringValue(this, p4ID)
9797 let totalSalee = getIntegerValue(this, totalSale)
9898 let forSalee = getIntegerValue(this, forSale)
9999 let minInvest = getIntegerValue(this, mia)
100100 if ((presaleStart >= h))
101101 then throw("presale has not been started yet")
102102 else if ((h >= presaleEnd))
103103 then throw("presale has been already ended")
104104 else if ((size(i.payments) != 1))
105105 then throw("exactly 1 payment is expected")
106106 else if (if (if (if ((pmtAssetId != asset1))
107107 then (pmtAssetId != asset2)
108108 else false)
109109 then (pmtAssetId != asset3)
110110 else false)
111111 then (pmtAssetId != asset4)
112112 else false)
113113 then throw(((("invalid payment asset id:" + pmtAssetId) + " Expected:") + asset1))
114114 else if ((totalSalee >= forSalee))
115115 then throw("Pre-sale asset has been - sold consider to use smaller payment")
116116 else if ((minInvest > pmtAmount))
117117 then throw("Amount less than the minimum to be invested.")
118118 else {
119119 let calc = ((pmtAmount / price) * D8)
120120 let asi = match getInteger(this, (tinvest + toBase58String(i.caller.bytes))) {
121121 case az: Int =>
122122 az
123123 case _ =>
124124 0
125125 }
126126 [ScriptTransfer(i.caller, calc, mainAsset), IntegerEntry(totalSale, (totalSalee + calc)), IntegerEntry((tinvest + toBase58String(i.caller.bytes)), (calc + asi)), IntegerEntry(((((tinvest + toBase58String(i.caller.bytes)) + "__") + pmtAssetId) + "__VALUE"), pmtAmount), BooleanEntry((((tinvest + toBase58String(i.caller.bytes)) + "__") + pmtAssetId), true)]
127127 }
128128 }
129129
130130
131131
132132 @Callable(i)
133133 func adminV (Value,address,assetId) = if (if ((i.caller == this))
134134 then true
135135 else (i.caller == Address(getBinaryValue(this, "admin"))))
136136 then [ScriptTransfer(Address(fromBase58String(address)), Value, fromBase58String(assetId))]
137137 else throw(adminError)
138138
139139
140140
141141 @Callable(i)
142142 func time (presaleStart,presaleDuration,distributionDuration) = if (if ((i.caller == this))
143143 then true
144144 else (i.caller.bytes == getBinaryValue(this, "admin")))
145145 then if ((presaleDuration >= presaleStart))
146146 then throw("PresaleDuration can't be bigger than PresaleStart")
147147 else [IntegerEntry(ps, presaleStart), IntegerEntry(pd, presaleDuration), IntegerEntry(disdu, distributionDuration)]
148148 else throw(adminError)
149149
150150
151151 @Verifier(tx)
152152 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
153153

github/deemru/w8io/169f3d6 
40.19 ms