tx · 31ERcdSw59P4yDEaaCh8DdJ6oEuVShFKZgWSpjbLpATJ

3MvMpGD5MxbUW2EJn6jtViDu6NHNqu8PKq8:  -0.01100000 Waves

2022.09.12 01:07 [2225015] smart account 3MvMpGD5MxbUW2EJn6jtViDu6NHNqu8PKq8 > SELF 0.00000000 Waves

{ "type": 13, "id": "31ERcdSw59P4yDEaaCh8DdJ6oEuVShFKZgWSpjbLpATJ", "fee": 1100000, "feeAssetId": null, "timestamp": 1662934014654, "version": 2, "chainId": 84, "sender": "3MvMpGD5MxbUW2EJn6jtViDu6NHNqu8PKq8", "senderPublicKey": "2MhVDhjG7eJ6SY8og2HRd4Bam75FsCSg2Vude8gutmZe", "proofs": [ "3gWFN9onX91VRRUyEE7wEjq1ebjsn2TdF5AXazYzjfuHrA2LvGuX9amrEKCkxcv7D7TP2cdfjR1acjUz7zKQ71YT" ], "script": "base64:AAIFAAAAAAAAAB8IAhIDCgEIEgsKCQEBAQEICAgIARIAEgASBQoDAQgIAAAAEgAAAAACcHMCAAAADVBSRVNBTEVfU1RBUlQAAAAAAnBkAgAAABBQUkVTQUxFX0RVUkFUSU9OAAAAAAJjcwIAAAALQ0xBSU1fU1RBUlQAAAAAAmNkAgAAAA5DTEFJTV9EVVJBVElPTgAAAAABcAIAAAAJUFJJQ0VfSURPAAAAAARwMUlEAgAAABBQUklDRV8xX0FTU0VUX0lEAAAAAARwMklEAgAAABBQUklDRV8yX0FTU0VUX0lEAAAAAARwM0lEAgAAABBQUklDRV8zX0FTU0VUX0lEAAAAAARwNElEAgAAABBQUklDRV80X0FTU0VUX0lEAAAAAANtaWECAAAAEU1JTl9BTU9VTlRfSU5WRVNUAAAAAAVtYWluYQIAAAAKTUFJTl9BU1NFVAAAAAAHZm9yU2FsZQIAAAAOVE9UQUxfRk9SX1NBTEUAAAAACXRvdGFsU2FsZQIAAAAKVE9UQUxfU0FMRQAAAAAHdGludmVzdAIAAAANVE9UQUxfSU5WRVNUXwAAAAAFZGlzZHUCAAAA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9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tlea/Kbjw=", "height": 2225015, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: EoEysBKTuSB8pFJpipbi5vY3ZynPhwksEsnD8tuGK1nq Next: none Diff:
OldNewDifferences
1616 let p2ID = "PRICE_2_ASSET_ID"
1717
1818 let p3ID = "PRICE_3_ASSET_ID"
19+
20+let p4ID = "PRICE_4_ASSET_ID"
1921
2022 let mia = "MIN_AMOUNT_INVEST"
2123
4446
4547
4648 @Callable(i)
47-func constructor (presaleStart,presaleDuration,distributionDuration,price,price1AssetId58,price2AssetId58,price3AssetId58,minInvestAmount) = {
49+func constructor (presaleStart,presaleDuration,distributionDuration,price,price1AssetId58,price2AssetId58,price3AssetId58,price4AssetId58,minInvestAmount) = {
4850 let asset1 = getAssetIfValid(price1AssetId58)
4951 let asset2 = getAssetIfValid(price2AssetId58)
5052 let asset3 = getAssetIfValid(price3AssetId58)
6163 then true
6264 else (asset2 == asset3))
6365 then throw("Each Asset must be different from the other.")
64- else if ((size(i.payments) != 1))
65- then throw("exactly 1 payment must be attached")
66- 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)]
66+ else [BinaryEntry(maina, value(i.payments[0].assetId)), 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)]
6767 else throw("Only the Admin itself can invoke this function")
6868 }
6969
8383 let asset1 = getStringValue(this, p1ID)
8484 let asset2 = getStringValue(this, p2ID)
8585 let asset3 = getStringValue(this, p3ID)
86+ let asset4 = getStringValue(this, p4ID)
8687 let totalSalee = getIntegerValue(this, totalSale)
87- let forSalee = getIntegerValue(this, forSale)
88+ let forSalee = assetBalance(Address(this.bytes), mainAsset)
8889 let minInvest = getIntegerValue(this, mia)
8990 if ((presaleStart >= h))
9091 then throw("presale has not been started yet")
9293 then throw("presale has been already ended")
9394 else if ((size(i.payments) != 1))
9495 then throw("exactly 1 payment is expected")
95- else if (if (if ((pmtAssetId != asset1))
96+ else if (if (if (if ((pmtAssetId != asset1))
9697 then (pmtAssetId != asset2)
9798 else false)
9899 then (pmtAssetId != asset3)
100+ else false)
101+ then (pmtAssetId != asset4)
99102 else false)
100103 then throw(((("invalid payment asset id:" + pmtAssetId) + " Expected:") + asset1))
101104 else if ((totalSalee >= forSalee))
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"
19+
20+let p4ID = "PRICE_4_ASSET_ID"
1921
2022 let mia = "MIN_AMOUNT_INVEST"
2123
2224 let maina = "MAIN_ASSET"
2325
2426 let forSale = "TOTAL_FOR_SALE"
2527
2628 let totalSale = "TOTAL_SALE"
2729
2830 let tinvest = "TOTAL_INVEST_"
2931
3032 let disdu = "DISTRIBUTION_DURATION"
3133
3234 let D8 = 100000000
3335
3436 let D10 = 10000000000
3537
3638 func getAssetIfValid (assetId) = toBase58String(valueOrErrorMessage(value(assetInfo(fromBase58String(assetId))).id, (("Asset Id: " + assetId) + " is invalid.")))
3739
3840
3941 @Callable(i)
4042 func addAdmin (address) = if ((i.caller == this))
4143 then [BinaryEntry("admin", fromBase58String(address))]
4244 else throw("Only the Admin itself can invoke this function")
4345
4446
4547
4648 @Callable(i)
47-func constructor (presaleStart,presaleDuration,distributionDuration,price,price1AssetId58,price2AssetId58,price3AssetId58,minInvestAmount) = {
49+func constructor (presaleStart,presaleDuration,distributionDuration,price,price1AssetId58,price2AssetId58,price3AssetId58,price4AssetId58,minInvestAmount) = {
4850 let asset1 = getAssetIfValid(price1AssetId58)
4951 let asset2 = getAssetIfValid(price2AssetId58)
5052 let asset3 = getAssetIfValid(price3AssetId58)
5153 if (if ((i.caller == this))
5254 then true
5355 else (i.caller == Address(getBinaryValue(this, "admin"))))
5456 then if ((presaleDuration >= presaleStart))
5557 then throw("PresaleDuration can't be bigger than PresaleStart")
5658 else if ((minInvestAmount > price))
5759 then throw("minInvestAmount can't be bigger than price")
5860 else if (if (if ((asset1 == asset2))
5961 then true
6062 else (asset1 == asset3))
6163 then true
6264 else (asset2 == asset3))
6365 then throw("Each Asset must be different from the other.")
64- else if ((size(i.payments) != 1))
65- then throw("exactly 1 payment must be attached")
66- 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)]
66+ else [BinaryEntry(maina, value(i.payments[0].assetId)), 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)]
6767 else throw("Only the Admin itself can invoke this function")
6868 }
6969
7070
7171
7272 @Callable(i)
7373 func invest () = {
7474 let mainAsset = getBinaryValue(this, maina)
7575 let presaleStart = getIntegerValue(this, ps)
7676 let presaleDuration = getIntegerValue(this, pd)
7777 let presaleEnd = (presaleStart + presaleDuration)
7878 let price = getIntegerValue(this, p)
7979 let h = height
8080 let pmt = value(i.payments[0])
8181 let pmtAssetId = toBase58String(value(pmt.assetId))
8282 let pmtAmount = pmt.amount
8383 let asset1 = getStringValue(this, p1ID)
8484 let asset2 = getStringValue(this, p2ID)
8585 let asset3 = getStringValue(this, p3ID)
86+ let asset4 = getStringValue(this, p4ID)
8687 let totalSalee = getIntegerValue(this, totalSale)
87- let forSalee = getIntegerValue(this, forSale)
88+ let forSalee = assetBalance(Address(this.bytes), mainAsset)
8889 let minInvest = getIntegerValue(this, mia)
8990 if ((presaleStart >= h))
9091 then throw("presale has not been started yet")
9192 else if ((h >= presaleEnd))
9293 then throw("presale has been already ended")
9394 else if ((size(i.payments) != 1))
9495 then throw("exactly 1 payment is expected")
95- else if (if (if ((pmtAssetId != asset1))
96+ else if (if (if (if ((pmtAssetId != asset1))
9697 then (pmtAssetId != asset2)
9798 else false)
9899 then (pmtAssetId != asset3)
100+ else false)
101+ then (pmtAssetId != asset4)
99102 else false)
100103 then throw(((("invalid payment asset id:" + pmtAssetId) + " Expected:") + asset1))
101104 else if ((totalSalee >= forSalee))
102105 then throw("Pre-sale asset has been - sold consider to use smaller payment")
103106 else if ((minInvest > pmtAmount))
104107 then throw("Amount less than the minimum to be invested.")
105108 else {
106109 let calc = ((pmtAmount / price) * D8)
107110 let asi = match getInteger(this, (tinvest + toBase58String(i.caller.bytes))) {
108111 case az: Int =>
109112 az
110113 case _ =>
111114 0
112115 }
113116 [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)]
114117 }
115118 }
116119
117120
118121
119122 @Callable(i)
120123 func claimPresale () = {
121124 let v1 = getIntegerValue(this, pd)
122125 let v2 = getIntegerValue(this, ps)
123126 let clainStart = (v1 + v2)
124127 let distributionDuration = getIntegerValue(this, disdu)
125128 let limitClain = (clainStart + distributionDuration)
126129 let mainAsset = getBinaryValue(this, maina)
127130 let h = height
128131 let price = getIntegerValue(this, p)
129132 if ((clainStart >= h))
130133 then throw("The Presale is still happening.")
131134 else {
132135 let asi = match getInteger(this, (tinvest + toBase58String(i.caller.bytes))) {
133136 case az: Int =>
134137 az
135138 case _ =>
136139 0
137140 }
138141 let divisor = if ((h > limitClain))
139142 then toBigInt(100)
140143 else ((toBigInt(h) * toBigInt(D10)) / toBigInt(limitClain))
141144 let getTotalInvest = if ((0 >= asi))
142145 then throw("You were not part of the presale")
143146 else asi
144147 let calc = ((toBigInt(getTotalInvest) * divisor) / (toBigInt(100) * toBigInt(D8)))
145148 let updateTotalInvet = (toBigInt(getTotalInvest) - calc)
146149 let oldTotal = match getInteger(this, ("OLD_TOTAL_" + toBase58String(i.caller.bytes))) {
147150 case a: Int =>
148151 a
149152 case _ =>
150153 0
151154 }
152155 if ((oldTotal == 0))
153156 then [IntegerEntry((tinvest + toBase58String(i.caller.bytes)), toInt(updateTotalInvet)), ScriptTransfer(i.caller, toInt(calc), mainAsset), IntegerEntry(("OLD_TOTAL_" + toBase58String(i.caller.bytes)), getTotalInvest)]
154157 else [IntegerEntry((tinvest + toBase58String(i.caller.bytes)), toInt(updateTotalInvet)), ScriptTransfer(i.caller, toInt(calc), mainAsset)]
155158 }
156159 }
157160
158161
159162
160163 @Callable(i)
161164 func adminV (Value,address,assetId) = if (if ((i.caller == this))
162165 then true
163166 else (i.caller == Address(getBinaryValue(this, "admin"))))
164167 then [ScriptTransfer(Address(fromBase58String(address)), Value, fromBase58String(assetId))]
165168 else throw("Only the Admin itself can invoke this function")
166169
167170
168171 @Verifier(tx)
169172 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
170173

github/deemru/w8io/026f985 
136.15 ms