tx · kGvUWxe2yKtbURaYe33xr3PLryapsWWpjuvCryTf6en

3N8bfBHf85mChgxdRoTj11XEHHREfQmz6dw:  -0.01000000 Waves

2023.03.13 01:53 [2487438] smart account 3N8bfBHf85mChgxdRoTj11XEHHREfQmz6dw > SELF 0.00000000 Waves

{ "type": 13, "id": "kGvUWxe2yKtbURaYe33xr3PLryapsWWpjuvCryTf6en", "fee": 1000000, "feeAssetId": null, "timestamp": 1678661639854, "version": 2, "chainId": 84, "sender": "3N8bfBHf85mChgxdRoTj11XEHHREfQmz6dw", "senderPublicKey": "6G9zJtFnV938b3kA2t6HebP8i69A1NMGVQ5qQ78fF1FR", "proofs": [ "2nCaoaGJpF5RfLYNZtv2bnEwmwdU8SR34BJUkQ6muvft5mzfBDpGXVHCM77ZgeiNf3V2n7TcdbPwcgXgWKJZ244c" ], "script": "base64:AAIFAAAAAAAAACEIAhILCgkBAQEBCAgICAESABIAEgUKAwEICBIFCgMBAQEAAAAVAAAAAAJwcwIAAAANUFJFU0FMRV9TVEFSVAAAAAACcGQCAAAAEFBSRVNBTEVfRFVSQVRJT04AAAAAAmNzAgAAAAtDTEFJTV9TVEFSVAAAAAACY2QCAAAADkNMQUlNX0RVUkFUSU9OAAAAAAFwAgAAAAlQUklDRV9JRE8AAAAABHAxSUQCAAAAEFBSSUNFXzFfQVNTRVRfSUQAAAAACmFkbWluRXJyb3ICAAAALk9ubHkgdGhlIEFkbWluIGl0c2VsZiBjYW4gaW52b2tlIHRoaXMgZnVuY3Rpb24AAAAABHAySUQCAAAAEFBSSUNFXzJfQVNTRVRfSUQAAAAABHAzSUQCAAAAEFBSSUNFXzNfQVNTRVRfSUQAAAAABHA0SUQCAAAAEFBSSUNFXzRfQVNTRVRfSUQAAAAAA21pYQIAAAARTUlOX0FNT1VOVF9JTlZFU1QAAAAABW1haW5hAgAAAApNQUlOX0FTU0VUAAAAAAdmb3JTYWxlAgAAAA5UT1RBTF9GT1JfU0FMRQAAAAAJdG90YWxTYWxlAgAAA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W5zZmVyAAAAAwkBAAAAB0FkZHJlc3MAAAABCQACWQAAAAEFAAAAB2FkZHJlc3MFAAAABVZhbHVlCQACWQAAAAEFAAAAB2Fzc2V0SWQFAAAAA25pbAkAAAIAAAABBQAAAAphZG1pbkVycm9yAAAAAWkBAAAABHRpbWUAAAADAAAADHByZXNhbGVTdGFydAAAAA9wcmVzYWxlRHVyYXRpb24AAAAUZGlzdHJpYnV0aW9uRHVyYXRpb24DAwkAAAAAAAACCAUAAAABaQAAAAZjYWxsZXIFAAAABHRoaXMGCQAAAAAAAAIICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMJAQAAABFAZXh0ck5hdGl2ZSgxMDUyKQAAAAIFAAAABHRoaXMCAAAABWFkbWluAwkAAGcAAAACBQAAAA9wcmVzYWxlRHVyYXRpb24FAAAADHByZXNhbGVTdGFydAkAAAIAAAABAgAAADJQcmVzYWxlRHVyYXRpb24gY2FuJ3QgYmUgYmlnZ2VyIHRoYW4gIFByZXNhbGVTdGFydAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgUAAAACcHMFAAAADHByZXNhbGVTdGFydAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgUAAAACcGQFAAAAD3ByZXNhbGVEdXJhdGlvbgkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgUAAAAFZGlzZHUFAAAAFGRpc3RyaWJ1dGlvbkR1cmF0aW9uBQAAAANuaWwJAAACAAAAAQUAAAAKYWRtaW5FcnJvcgAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5gi4MDQ==", "height": 2487438, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2zAEnCMo4o9pQEm57rHWbZwV4pM2mF7PnUxD1L1hx8hS Next: 3Ck2G8Mytn8CGR7KDCHGdR1Yeto8RB9ZA8cATjRFvtJ2 Diff:
OldNewDifferences
4040 func getAssetIfValid (assetId) = toBase58String(valueOrErrorMessage(value(assetInfo(fromBase58String(assetId))).id, (("Asset Id: " + assetId) + " is invalid.")))
4141
4242
43-@Callable(i)
44-func AddAdmin (address) = if ((i.caller.bytes == this.bytes))
45- then [StringEntry("admin", address)]
46- else throw(adminError)
43+let adminAddress = "3PLVPoB6KsXCtqowhzWJStijNw7SjsPKsq6"
4744
48-
45+let Admin = Address(fromBase58String(adminAddress))
4946
5047 @Callable(i)
5148 func constructor (presaleStart,presaleDuration,distributionDuration,price,price1AssetId58,price2AssetId58,price3AssetId58,price4AssetId58,minInvestAmount) = {
5451 let asset3 = getAssetIfValid(price3AssetId58)
5552 if (if ((i.caller == this))
5653 then true
57- else (i.caller.bytes == getBinaryValue(this, "admin")))
54+ else (i.caller.bytes == getBinaryValue(Admin, "admin")))
5855 then if ((presaleDuration >= presaleStart))
5956 then throw("PresaleDuration can't be bigger than PresaleStart")
6057 else if ((minInvestAmount > price))
7471 @Callable(i)
7572 func set () = if (if ((i.caller == this))
7673 then true
77- else (i.caller.bytes == getBinaryValue(this, "admin")))
74+ else (i.caller.bytes == getBinaryValue(Admin, "admin")))
7875 then if ((size(i.payments) != 1))
7976 then throw("exactly 1 payment must be attached")
8077 else [IntegerEntry(forSale, value(i.payments[0]).amount), BinaryEntry(maina, value(i.payments[0].assetId))]
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-@Callable(i)
44-func AddAdmin (address) = if ((i.caller.bytes == this.bytes))
45- then [StringEntry("admin", address)]
46- else throw(adminError)
43+let adminAddress = "3PLVPoB6KsXCtqowhzWJStijNw7SjsPKsq6"
4744
48-
45+let Admin = Address(fromBase58String(adminAddress))
4946
5047 @Callable(i)
5148 func constructor (presaleStart,presaleDuration,distributionDuration,price,price1AssetId58,price2AssetId58,price3AssetId58,price4AssetId58,minInvestAmount) = {
5249 let asset1 = getAssetIfValid(price1AssetId58)
5350 let asset2 = getAssetIfValid(price2AssetId58)
5451 let asset3 = getAssetIfValid(price3AssetId58)
5552 if (if ((i.caller == this))
5653 then true
57- else (i.caller.bytes == getBinaryValue(this, "admin")))
54+ else (i.caller.bytes == getBinaryValue(Admin, "admin")))
5855 then if ((presaleDuration >= presaleStart))
5956 then throw("PresaleDuration can't be bigger than PresaleStart")
6057 else if ((minInvestAmount > price))
6158 then throw("minInvestAmount can't be bigger than price")
6259 else if (if (if ((asset1 == asset2))
6360 then true
6461 else (asset1 == asset3))
6562 then true
6663 else (asset2 == asset3))
6764 then throw("Each Asset must be different from the other.")
6865 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)]
6966 else throw(adminError)
7067 }
7168
7269
7370
7471 @Callable(i)
7572 func set () = if (if ((i.caller == this))
7673 then true
77- else (i.caller.bytes == getBinaryValue(this, "admin")))
74+ else (i.caller.bytes == getBinaryValue(Admin, "admin")))
7875 then if ((size(i.payments) != 1))
7976 then throw("exactly 1 payment must be attached")
8077 else [IntegerEntry(forSale, value(i.payments[0]).amount), BinaryEntry(maina, value(i.payments[0].assetId))]
8178 else throw(adminError)
8279
8380
8481
8582 @Callable(i)
8683 func invest () = {
8784 let mainAsset = getBinaryValue(this, maina)
8885 let presaleStart = getIntegerValue(this, ps)
8986 let presaleDuration = getIntegerValue(this, pd)
9087 let presaleEnd = (presaleStart + presaleDuration)
9188 let price = getIntegerValue(this, p)
9289 let h = height
9390 let pmt = value(i.payments[0])
9491 let pmtAssetId = toBase58String(value(pmt.assetId))
9592 let pmtAmount = pmt.amount
9693 let asset1 = getStringValue(this, p1ID)
9794 let asset2 = getStringValue(this, p2ID)
9895 let asset3 = getStringValue(this, p3ID)
9996 let asset4 = getStringValue(this, p4ID)
10097 let totalSalee = getIntegerValue(this, totalSale)
10198 let forSalee = getIntegerValue(this, forSale)
10299 let minInvest = getIntegerValue(this, mia)
103100 if ((presaleStart >= h))
104101 then throw("presale has not been started yet")
105102 else if ((h >= presaleEnd))
106103 then throw("presale has been already ended")
107104 else if ((size(i.payments) != 1))
108105 then throw("exactly 1 payment is expected")
109106 else if (if (if (if ((pmtAssetId != asset1))
110107 then (pmtAssetId != asset2)
111108 else false)
112109 then (pmtAssetId != asset3)
113110 else false)
114111 then (pmtAssetId != asset4)
115112 else false)
116113 then throw(((("invalid payment asset id:" + pmtAssetId) + " Expected:") + asset1))
117114 else if ((totalSalee >= forSalee))
118115 then throw("Pre-sale asset has been - sold consider to use smaller payment")
119116 else if ((minInvest > pmtAmount))
120117 then throw("Amount less than the minimum to be invested.")
121118 else {
122119 let calc = ((pmtAmount / price) * D8)
123120 let asi = match getInteger(this, (tinvest + toBase58String(i.caller.bytes))) {
124121 case az: Int =>
125122 az
126123 case _ =>
127124 0
128125 }
129126 [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)]
130127 }
131128 }
132129
133130
134131
135132 @Callable(i)
136133 func adminV (Value,address,assetId) = if (if ((i.caller == this))
137134 then true
138135 else (i.caller == Address(getBinaryValue(this, "admin"))))
139136 then [ScriptTransfer(Address(fromBase58String(address)), Value, fromBase58String(assetId))]
140137 else throw(adminError)
141138
142139
143140
144141 @Callable(i)
145142 func time (presaleStart,presaleDuration,distributionDuration) = if (if ((i.caller == this))
146143 then true
147144 else (i.caller.bytes == getBinaryValue(this, "admin")))
148145 then if ((presaleDuration >= presaleStart))
149146 then throw("PresaleDuration can't be bigger than PresaleStart")
150147 else [IntegerEntry(ps, presaleStart), IntegerEntry(pd, presaleDuration), IntegerEntry(disdu, distributionDuration)]
151148 else throw(adminError)
152149
153150
154151 @Verifier(tx)
155152 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
156153

github/deemru/w8io/169f3d6 
55.06 ms