tx · A7GZty8U4QHxT9dV6KUQYSYTaWs4sBfu3sM5CxPML9eH

3MvMpGD5MxbUW2EJn6jtViDu6NHNqu8PKq8:  -0.01100000 Waves

2022.08.26 00:54 [2200580] smart account 3MvMpGD5MxbUW2EJn6jtViDu6NHNqu8PKq8 > SELF 0.00000000 Waves

{ "type": 13, "id": "A7GZty8U4QHxT9dV6KUQYSYTaWs4sBfu3sM5CxPML9eH", "fee": 1100000, "feeAssetId": null, "timestamp": 1661464510298, "version": 2, "chainId": 84, "sender": "3MvMpGD5MxbUW2EJn6jtViDu6NHNqu8PKq8", "senderPublicKey": "2MhVDhjG7eJ6SY8og2HRd4Bam75FsCSg2Vude8gutmZe", "proofs": [ "5SYYddaXYvJPmYEqnqKiNGwMhJV4xfoKVVqE62zeHnWxoSexebUz4p7genA7BkEbnajJkCFifqFzn4cWGY6WcxMS" ], "script": "base64:AAIFAAAAAAAAAB4IAhIDCgEIEgoKCAEBAQEICAgBEgASABIFCgMBCAgAAAAPAAAAAAJwcwIAAAANUFJFU0FMRV9TVEFSVAAAAAACcGQCAAAAEFBSRVNBTEVfRFVSQVRJT04AAAAAAmNzAgAAAAtDTEFJTV9TVEFSVAAAAAACY2QCAAAADkNMQUlNX0RVUkFUSU9OAAAAAAFwAgAAAAlQUklDRV9JRE8AAAAABHAxSUQCAAAAEFBSSUNFXzFfQVNTRVRfSUQAAAAABHAySUQCAAAAEFBSSUNFXzJfQVNTRVRfSUQAAAAABHAzSUQCAAAAEFBSSUNFXzNfQVNTRVRfSUQAAAAAA21pYQIAAAARTUlOX0FNT1VOVF9JTlZFU1QAAAAABW1haW5hAgAAAApNQUlOX0FTU0VUAAAAAAdmb3JTYWxlAgAAAA5UT1RBTF9GT1JfU0FMRQAAAAAJdG90YWxTYWxlAgAAAApUT1RBTF9TQUxFAAAAAAd0aW52ZXN0AgAAAA1UT1RBTF9JTlZFU1RfAAAAAAVkaXNkdQIAAAAVRElTVFJJQlVUSU9OX0RVUkFUSU9OAQAAAA9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AAAAA25pbAkAAAIAAAABAgAAAC5Pbmx5IHRoZSBBZG1pbiBpdHNlbGYgY2FuIGludm9rZSB0aGlzIGZ1bmN0aW9uAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXkkj/Sl", "height": 2200580, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CmUUWiV1Uj4tVsjRrN8Lnzyy3kqJBU4p9CEUt3wrs4g1 Next: WK7g5BecQbCG5zyV4zfZMjhRpbVv46QzQ8mAudy3gRA Diff:
OldNewDifferences
4949 else (i.caller == Address(getBinaryValue(this, "admin"))))
5050 then if ((presaleDuration >= presaleStart))
5151 then throw("PresaleDuration can't be bigger than PresaleStart")
52- else if ((minInvestAmount >= price))
52+ else if ((minInvestAmount > price))
5353 then throw("minInvestAmount can't be bigger than price")
5454 else if (if (if ((asset1 == asset2))
5555 then true
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 p2ID = "PRICE_2_ASSET_ID"
1717
1818 let p3ID = "PRICE_3_ASSET_ID"
1919
2020 let mia = "MIN_AMOUNT_INVEST"
2121
2222 let maina = "MAIN_ASSET"
2323
2424 let forSale = "TOTAL_FOR_SALE"
2525
2626 let totalSale = "TOTAL_SALE"
2727
2828 let tinvest = "TOTAL_INVEST_"
2929
3030 let disdu = "DISTRIBUTION_DURATION"
3131
3232 func getAssetIfValid (assetId) = toBase58String(valueOrErrorMessage(value(assetInfo(fromBase58String(assetId))).id, (("Asset Id: " + assetId) + " is invalid.")))
3333
3434
3535 @Callable(i)
3636 func addAdmin (address) = if ((i.caller == this))
3737 then [BinaryEntry("admin", fromBase58String(address))]
3838 else throw("Only the Admin itself can invoke this function")
3939
4040
4141
4242 @Callable(i)
4343 func constructor (presaleStart,presaleDuration,distributionDuration,price,price1AssetId58,price2AssetId58,price3AssetId58,minInvestAmount) = {
4444 let asset1 = getAssetIfValid(price1AssetId58)
4545 let asset2 = getAssetIfValid(price2AssetId58)
4646 let asset3 = getAssetIfValid(price3AssetId58)
4747 if (if ((i.caller == this))
4848 then true
4949 else (i.caller == Address(getBinaryValue(this, "admin"))))
5050 then if ((presaleDuration >= presaleStart))
5151 then throw("PresaleDuration can't be bigger than PresaleStart")
52- else if ((minInvestAmount >= price))
52+ else if ((minInvestAmount > price))
5353 then throw("minInvestAmount can't be bigger than price")
5454 else if (if (if ((asset1 == asset2))
5555 then true
5656 else (asset1 == asset3))
5757 then true
5858 else (asset2 == asset3))
5959 then throw("Each Asset must be different from the other.")
6060 else if ((size(i.payments) != 1))
6161 then throw("exactly 1 payment must be attached")
6262 else [BinaryEntry(maina, value(i.payments[0].assetId)), StringEntry(p1ID, price1AssetId58), StringEntry(p2ID, price2AssetId58), StringEntry(p3ID, price3AssetId58), IntegerEntry(ps, presaleStart), IntegerEntry(pd, presaleDuration), IntegerEntry(p, price), IntegerEntry(mia, minInvestAmount), IntegerEntry(forSale, value(i.payments[0]).amount), IntegerEntry(totalSale, 0), IntegerEntry(disdu, distributionDuration)]
6363 else throw("Only the Admin itself can invoke this function")
6464 }
6565
6666
6767
6868 @Callable(i)
6969 func invest () = {
7070 let mainAsset = getBinaryValue(this, maina)
7171 let presaleStart = getIntegerValue(this, ps)
7272 let presaleDuration = getIntegerValue(this, pd)
7373 let presaleEnd = (presaleStart + presaleDuration)
7474 let price = getIntegerValue(this, p)
7575 let h = height
7676 let pmt = value(i.payments[0])
7777 let pmtAssetId = toBase58String(value(pmt.assetId))
7878 let pmtAmount = pmt.amount
7979 let asset1 = getStringValue(this, p1ID)
8080 let asset2 = getStringValue(this, p2ID)
8181 let asset3 = getStringValue(this, p3ID)
8282 let totalSalee = getIntegerValue(this, totalSale)
8383 let forSalee = getIntegerValue(this, forSale)
8484 let minInvest = getIntegerValue(this, mia)
8585 if ((presaleStart >= h))
8686 then throw("presale has not been started yet")
8787 else if ((h >= presaleEnd))
8888 then throw("presale has been already ended")
8989 else if ((size(i.payments) != 1))
9090 then throw("exactly 1 payment is expected")
9191 else if (if (if ((pmtAssetId != asset1))
9292 then (pmtAssetId != asset2)
9393 else false)
9494 then (pmtAssetId != asset3)
9595 else false)
9696 then throw(((("invalid payment asset id:" + pmtAssetId) + " Expected:") + asset1))
9797 else if ((totalSalee >= forSalee))
9898 then throw("Pre-sale asset has been - sold consider to use smaller payment")
9999 else if ((minInvest > pmtAmount))
100100 then throw("Amount less than the minimum to be invested.")
101101 else {
102102 let calc = ((pmtAmount / price) * 100000000)
103103 [IntegerEntry(totalSale, (totalSalee + calc)), ScriptTransfer(i.caller, calc, mainAsset), BooleanEntry((((tinvest + toBase58String(i.caller.bytes)) + "__") + pmtAssetId), true)]
104104 }
105105 }
106106
107107
108108
109109 @Callable(i)
110110 func claimPresale () = {
111111 let clainStart = (getIntegerValue(this, pd) + getIntegerValue(this, ps))
112112 let distributionDuration = getIntegerValue(this, disdu)
113113 let limitClain = (clainStart + distributionDuration)
114114 let mainAsset = getBinaryValue(this, maina)
115115 let h = height
116116 let price = getIntegerValue(this, p)
117117 if ((clainStart >= h))
118118 then throw("The Presale is still happening.")
119119 else {
120120 let divisor = if ((h > limitClain))
121121 then 100
122122 else (h / limitClain)
123123 let getTotalInvest = valueOrErrorMessage(getIntegerValue(this, (tinvest + toBase58String(i.caller.bytes))), "You were not part of the presale")
124124 let calc = ((getTotalInvest * divisor) / 100)
125125 let updateTotalInvet = (getTotalInvest - calc)
126126 if ((valueOrElse(getIntegerValue(this, ("OLD_TOTAL_" + toBase58String(i.caller.bytes))), 0) == 0))
127127 then [IntegerEntry((tinvest + toBase58String(i.caller.bytes)), updateTotalInvet), ScriptTransfer(i.caller, calc, mainAsset), IntegerEntry(("OLD_TOTAL_" + toBase58String(i.caller.bytes)), getTotalInvest)]
128128 else [IntegerEntry((tinvest + toBase58String(i.caller.bytes)), updateTotalInvet), ScriptTransfer(i.caller, calc, mainAsset)]
129129 }
130130 }
131131
132132
133133
134134 @Callable(i)
135135 func adminV (Value,address,assetId) = if (if ((i.caller == this))
136136 then true
137137 else (i.caller == Address(getBinaryValue(this, "admin"))))
138138 then [ScriptTransfer(Address(fromBase58String(address)), Value, fromBase58String(assetId))]
139139 else throw("Only the Admin itself can invoke this function")
140140
141141
142142 @Verifier(tx)
143143 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
144144

github/deemru/w8io/026f985 
38.72 ms