tx · r3PrWhbYEtmByewYPc9EQ54C9ZcnEzjJRHbJpPd5ojg

3Mw7mAf2p8drjeSSDEbq6yyFhjqTgDcwGFB:  -0.04000000 Waves

2022.05.05 19:27 [2038635] smart account 3Mw7mAf2p8drjeSSDEbq6yyFhjqTgDcwGFB > SELF 0.00000000 Waves

{ "type": 13, "id": "r3PrWhbYEtmByewYPc9EQ54C9ZcnEzjJRHbJpPd5ojg", "fee": 4000000, "feeAssetId": null, "timestamp": 1651768105736, "version": 2, "chainId": 84, "sender": "3Mw7mAf2p8drjeSSDEbq6yyFhjqTgDcwGFB", "senderPublicKey": "Ti5K4A5REvfgdfj3SWhhb2wJXRKenVb3WPQ6tE1TaKe", "proofs": [ "4Knu4DHRtYrUVKeYZ74deqraarumTZnasP42n6PoZkSnbxqbyq3GpR76a36YmMhXvPThm89wUReoSFdtVsfwf1m4" ], "script": "base64:AAIFAAAAAAAAABYIAhIDCgEIEgsKCQEBAQEBCAgIARIAAAAADgAAAAACcHMCAAAADVBSRVNBTEVfU1RBUlQAAAAAAnBkAgAAABBQUkVTQUxFX0RVUkFUSU9OAAAAAAJjcwIAAAALQ0xBSU1fU1RBUlQAAAAAAmNkAgAAAA5DTEFJTV9EVVJBVElPTgAAAAABcAIAAAAJUFJJQ0VfSURPAAAAAARwMUlEAgAAABBQUklDRV8xX0FTU0VUX0lEAAAAAARwMklEAgAAABBQUklDRV8yX0FTU0VUX0lEAAAAAARwM0lEAgAAABBQUklDRV8zX0FTU0VUX0lEAAAAAANtaWECAAAAEU1JTl9BTU9VTlRfSU5WRVNUAAAAAAVtYWluYQIAAAAKTUFJTl9BU1NFVAAAAAAHZm9yU2FsZQIAAAAOVE9UQUxfRk9SX1NBTEUAAAAACXRvdGFsU2FsZQIAAAAKVE9UQUxfU0FMRQAAAAAHdGludmVzdAIAAAANVE9UQUxfSU5WRVNUXwEAAAAPZ2V0QXNzZXRJZlZhbGlkAAAAAQAAAAdhc3NldElkCQACWAAAAAEJAQAAABN2YWx1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AAAd0aW52ZXN0CQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMFAAAAC3RvdGFsQW1vdW50CQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACBQAAAAl0b3RhbFNhbGUJAABkAAAAAgUAAAAKdG90YWxTYWxlZQUAAAAEY2FsYwkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAABGNhbGMFAAAACW1haW5Bc3NldAkABEwAAAACCQEAAAAMQm9vbGVhbkVudHJ5AAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgUAAAAHdGludmVzdAkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzAgAAAAJfXwUAAAAKcG10QXNzZXRJZAYFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5B+fkHw==", "height": 2038635, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9zH3ysV3By5RaYuBKqT5FTAbFjhcxbWY8xaPXJnTjzbv Next: C5h8Grb2u1EhzvHBwWWChXAXPxMCGWd1XQip5tJNx73p Diff:
OldNewDifferences
104104 let getTInvest = valueOrElse(getIntegerValue(this, (tinvest + toBase58String(i.caller.bytes))), 0)
105105 let calc = (pmtAmount / price)
106106 let totalAmount = (pmtAmount + getTInvest)
107-[IntegerEntry((tinvest + toBase58String(i.caller.bytes)), totalAmount), IntegerEntry(totalSale, (totalSalee + calc)), BooleanEntry((((tinvest + toBase58String(i.caller.bytes)) + "__") + pmtAssetId), true)]
107+[IntegerEntry((tinvest + toBase58String(i.caller.bytes)), totalAmount), IntegerEntry(totalSale, (totalSalee + calc)), ScriptTransfer(i.caller, calc, mainAsset), BooleanEntry((((tinvest + toBase58String(i.caller.bytes)) + "__") + pmtAssetId), true)]
108108 }
109- }
110-
111-
112-
113-@Callable(i)
114-func claimPresale () = {
115- let mainAsset = getBinary(this, maina)
116- let h = height
117- let clainStart = getIntegerValue(this, cs)
118- let clainDuration = getIntegerValue(this, cd)
119- let clainEnd = (clainStart + clainDuration)
120- let price = getIntegerValue(this, p)
121- if ((clainStart >= h))
122- then throw("The Presale is still happening.")
123- else if ((h > clainEnd))
124- then {
125- let getTInvest = valueOrErrorMessage(getIntegerValue(this, (tinvest + toBase58String(i.caller.bytes))), "You were not part of the presale")
126- let calc = (getTInvest / price)
127- let distri = (calc / clainDuration)
128- let hSolicitatin = valueOrElse(getIntegerValue(this, ((tinvest + toBase58String(i.caller.bytes)) + "_HISTORY")), 0)
129- let diferencH = (clainDuration - hSolicitatin)
130- let finalValue = (distri * diferencH)
131-[IntegerEntry(((tinvest + toBase58String(i.caller.bytes)) + "_HISTORY"), (h - clainStart)), IntegerEntry((tinvest + toBase58String(i.caller.bytes)), (getTInvest - (finalValue * price))), ScriptTransfer(i.caller, finalValue, mainAsset)]
132- }
133- else {
134- let getTInvest = valueOrErrorMessage(getIntegerValue(this, (tinvest + toBase58String(i.caller.bytes))), "You were not part of the presale")
135- let calc = (getTInvest / price)
136- let distri = (calc / clainDuration)
137- let hSolicitatin = valueOrElse(getIntegerValue(this, ((tinvest + toBase58String(i.caller.bytes)) + "_HISTORY")), 0)
138- let diferencH = ((clainDuration - hSolicitatin) - (h - clainStart))
139- let finalValue = (distri * diferencH)
140-[IntegerEntry(((tinvest + toBase58String(i.caller.bytes)) + "_HISTORY"), (h - clainStart)), IntegerEntry((tinvest + toBase58String(i.caller.bytes)), (getTInvest - (finalValue * price))), ScriptTransfer(i.caller, finalValue, mainAsset)]
141- }
142109 }
143110
144111
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 func getAssetIfValid (assetId) = toBase58String(valueOrErrorMessage(value(assetInfo(fromBase58String(assetId))).id, (("Asset Id: " + assetId) + " is invalid.")))
3131
3232
3333 @Callable(i)
3434 func addAdmin (address) = if ((i.caller == this))
3535 then [BinaryEntry("admin", fromBase58String(address))]
3636 else throw("Only the Admin itself can invoke this function")
3737
3838
3939
4040 @Callable(i)
4141 func constructor (presaleStart,presaleDuration,claimStart,claimDuration,price,price1AssetId58,price2AssetId58,price3AssetId58,minInvestAmount) = {
4242 let asset1 = getAssetIfValid(price1AssetId58)
4343 let asset2 = getAssetIfValid(price2AssetId58)
4444 let asset3 = getAssetIfValid(price3AssetId58)
4545 if (if ((i.caller == this))
4646 then (i.caller == Address(getBinaryValue(this, "admin")))
4747 else false)
4848 then if ((presaleDuration >= presaleStart))
4949 then throw("PresaleDuration can't be bigger than PresaleStart")
5050 else if ((presaleDuration >= claimStart))
5151 then throw("presaleDuration can't be bigger than claimStart")
5252 else if ((claimDuration >= claimStart))
5353 then throw("claimDuration can't be bigger than claimStart")
5454 else if ((minInvestAmount >= price))
5555 then throw("minInvestAmount can't be bigger than price")
5656 else if (if (if ((asset1 == asset2))
5757 then true
5858 else (asset1 == asset3))
5959 then true
6060 else (asset2 == asset3))
6161 then throw("Each Asset must be different from the other.")
6262 else if ((size(i.payments) != 1))
6363 then throw("exactly 1 payment must be attached")
6464 else [BinaryEntry(maina, value(i.payments[0].assetId)), StringEntry(p1ID, price1AssetId58), StringEntry(p2ID, price2AssetId58), StringEntry(p3ID, price3AssetId58), IntegerEntry(ps, presaleStart), IntegerEntry(pd, presaleDuration), IntegerEntry(cs, claimStart), IntegerEntry(cd, claimDuration), IntegerEntry(p, price), IntegerEntry(mia, minInvestAmount), IntegerEntry(forSale, value(i.payments[0]).amount), IntegerEntry(totalSale, 0)]
6565 else throw("Only the Admin itself can invoke this function")
6666 }
6767
6868
6969
7070 @Callable(i)
7171 func invest () = {
7272 let mainAsset = getBinary(this, maina)
7373 let presaleStart = getIntegerValue(this, ps)
7474 let presaleDuration = getIntegerValue(this, pd)
7575 let presaleEnd = (presaleStart + presaleDuration)
7676 let price = getIntegerValue(this, p)
7777 let h = height
7878 let pmt = value(i.payments[0])
7979 let pmtAssetId = toBase58String(value(pmt.assetId))
8080 let pmtAmount = pmt.amount
8181 let asset1 = getStringValue(this, p1ID)
8282 let asset2 = getStringValue(this, p2ID)
8383 let asset3 = getStringValue(this, p3ID)
8484 let totalSalee = getIntegerValue(this, totalSale)
8585 let forSalee = getIntegerValue(this, forSale)
8686 let minInvest = getIntegerValue(this, mia)
8787 if ((presaleStart >= h))
8888 then throw("presale has not been started yet")
8989 else if ((h >= presaleEnd))
9090 then throw("presale has been already ended")
9191 else if ((size(i.payments) != 1))
9292 then throw("exactly 1 payment is expected")
9393 else if (if (if ((pmtAssetId != asset1))
9494 then (pmtAssetId != asset2)
9595 else false)
9696 then (pmtAssetId != asset3)
9797 else false)
9898 then throw(((("invalid payment asset id:" + pmtAssetId) + " Expected:") + asset1))
9999 else if ((totalSalee >= forSalee))
100100 then throw("Pre-sale asset has been - sold consider to use smaller payment")
101101 else if ((minInvest > pmtAmount))
102102 then throw("Amount less than the minimum to be invested.")
103103 else {
104104 let getTInvest = valueOrElse(getIntegerValue(this, (tinvest + toBase58String(i.caller.bytes))), 0)
105105 let calc = (pmtAmount / price)
106106 let totalAmount = (pmtAmount + getTInvest)
107-[IntegerEntry((tinvest + toBase58String(i.caller.bytes)), totalAmount), IntegerEntry(totalSale, (totalSalee + calc)), BooleanEntry((((tinvest + toBase58String(i.caller.bytes)) + "__") + pmtAssetId), true)]
107+[IntegerEntry((tinvest + toBase58String(i.caller.bytes)), totalAmount), IntegerEntry(totalSale, (totalSalee + calc)), ScriptTransfer(i.caller, calc, mainAsset), BooleanEntry((((tinvest + toBase58String(i.caller.bytes)) + "__") + pmtAssetId), true)]
108108 }
109- }
110-
111-
112-
113-@Callable(i)
114-func claimPresale () = {
115- let mainAsset = getBinary(this, maina)
116- let h = height
117- let clainStart = getIntegerValue(this, cs)
118- let clainDuration = getIntegerValue(this, cd)
119- let clainEnd = (clainStart + clainDuration)
120- let price = getIntegerValue(this, p)
121- if ((clainStart >= h))
122- then throw("The Presale is still happening.")
123- else if ((h > clainEnd))
124- then {
125- let getTInvest = valueOrErrorMessage(getIntegerValue(this, (tinvest + toBase58String(i.caller.bytes))), "You were not part of the presale")
126- let calc = (getTInvest / price)
127- let distri = (calc / clainDuration)
128- let hSolicitatin = valueOrElse(getIntegerValue(this, ((tinvest + toBase58String(i.caller.bytes)) + "_HISTORY")), 0)
129- let diferencH = (clainDuration - hSolicitatin)
130- let finalValue = (distri * diferencH)
131-[IntegerEntry(((tinvest + toBase58String(i.caller.bytes)) + "_HISTORY"), (h - clainStart)), IntegerEntry((tinvest + toBase58String(i.caller.bytes)), (getTInvest - (finalValue * price))), ScriptTransfer(i.caller, finalValue, mainAsset)]
132- }
133- else {
134- let getTInvest = valueOrErrorMessage(getIntegerValue(this, (tinvest + toBase58String(i.caller.bytes))), "You were not part of the presale")
135- let calc = (getTInvest / price)
136- let distri = (calc / clainDuration)
137- let hSolicitatin = valueOrElse(getIntegerValue(this, ((tinvest + toBase58String(i.caller.bytes)) + "_HISTORY")), 0)
138- let diferencH = ((clainDuration - hSolicitatin) - (h - clainStart))
139- let finalValue = (distri * diferencH)
140-[IntegerEntry(((tinvest + toBase58String(i.caller.bytes)) + "_HISTORY"), (h - clainStart)), IntegerEntry((tinvest + toBase58String(i.caller.bytes)), (getTInvest - (finalValue * price))), ScriptTransfer(i.caller, finalValue, mainAsset)]
141- }
142109 }
143110
144111
145112 @Verifier(tx)
146113 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
147114

github/deemru/w8io/fabc49c 
32.51 ms