tx · 9zH3ysV3By5RaYuBKqT5FTAbFjhcxbWY8xaPXJnTjzbv

3Mw7mAf2p8drjeSSDEbq6yyFhjqTgDcwGFB:  -0.04000000 Waves

2022.05.05 19:16 [2038626] smart account 3Mw7mAf2p8drjeSSDEbq6yyFhjqTgDcwGFB > SELF 0.00000000 Waves

{ "type": 13, "id": "9zH3ysV3By5RaYuBKqT5FTAbFjhcxbWY8xaPXJnTjzbv", "fee": 4000000, "feeAssetId": null, "timestamp": 1651767399367, "version": 2, "chainId": 84, "sender": "3Mw7mAf2p8drjeSSDEbq6yyFhjqTgDcwGFB", "senderPublicKey": "Ti5K4A5REvfgdfj3SWhhb2wJXRKenVb3WPQ6tE1TaKe", "proofs": [ "4oQChEwhNYrhA9p7X2xjguyBb2KAmzipTqdfykEZewizYDDEFZfQnpHwxarLSCYAsExScsw5scyK8cD19zPsqRCC" ], "script": "base64:AAIFAAAAAAAAABgIAhIDCgEIEgsKCQEBAQEBCAgIARIAEgAAAAAOAAAAAAJwcwIAAAANUFJFU0FMRV9TVEFSVAAAAAACcGQCAAAAEFBSRVNBTEVfRFVSQVRJT04AAAAAAmNzAgAAAAtDTEFJTV9TVEFSVAAAAAACY2QCAAAADkNMQUlNX0RVUkFUSU9OAAAAAAFwAgAAAAlQUklDRV9JRE8AAAAABHAxSUQCAAAAEFBSSUNFXzFfQVNTRVRfSUQAAAAABHAySUQCAAAAEFBSSUNFXzJfQVNTRVRfSUQAAAAABHAzSUQCAAAAEFBSSUNFXzNfQVNTRVRfSUQAAAAAA21pYQIAAAARTUlOX0FNT1VOVF9JTlZFU1QAAAAABW1haW5hAgAAAApNQUlOX0FTU0VUAAAAAAdmb3JTYWxlAgAAAA5UT1RBTF9GT1JfU0FMRQAAAAAJdG90YWxTYWxlAgAAAApUT1RBTF9TQUxFAAAAAAd0aW52ZXN0AgAAAA1UT1RBTF9JTlZFU1RfAQAAAA9nZXRBc3NldElmVmFsaWQAAAABAAAAB2Fzc2V0SWQJAAJYAAAAAQk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hbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAACmZpbmFsVmFsdWUFAAAACW1haW5Bc3NldAUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXlJ7J+v", "height": 2038626, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GjvuZTQCi5j8wBgKVKx29GaCLPC9J2YCMKRj9fbreLUf Next: r3PrWhbYEtmByewYPc9EQ54C9ZcnEzjJRHbJpPd5ojg Diff:
OldNewDifferences
4343 let asset2 = getAssetIfValid(price2AssetId58)
4444 let asset3 = getAssetIfValid(price3AssetId58)
4545 if (if ((i.caller == this))
46- then true
47- else (i.caller == Address(getBinaryValue(this, "admin"))))
46+ then (i.caller == Address(getBinaryValue(this, "admin")))
47+ else false)
4848 then if ((presaleDuration >= presaleStart))
4949 then throw("PresaleDuration can't be bigger than PresaleStart")
5050 else if ((presaleDuration >= claimStart))
9191 else if ((size(i.payments) != 1))
9292 then throw("exactly 1 payment is expected")
9393 else if (if (if ((pmtAssetId != asset1))
94- then true
95- else (pmtAssetId != asset2))
96- then true
97- else (pmtAssetId != asset3))
94+ then (pmtAssetId != asset2)
95+ else false)
96+ then (pmtAssetId != asset3)
97+ 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")
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))
46- then true
47- else (i.caller == Address(getBinaryValue(this, "admin"))))
46+ then (i.caller == Address(getBinaryValue(this, "admin")))
47+ 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))
94- then true
95- else (pmtAssetId != asset2))
96- then true
97- else (pmtAssetId != asset3))
94+ then (pmtAssetId != asset2)
95+ else false)
96+ then (pmtAssetId != asset3)
97+ 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)
107107 [IntegerEntry((tinvest + toBase58String(i.caller.bytes)), totalAmount), IntegerEntry(totalSale, (totalSalee + calc)), BooleanEntry((((tinvest + toBase58String(i.caller.bytes)) + "__") + pmtAssetId), true)]
108108 }
109109 }
110110
111111
112112
113113 @Callable(i)
114114 func claimPresale () = {
115115 let mainAsset = getBinary(this, maina)
116116 let h = height
117117 let clainStart = getIntegerValue(this, cs)
118118 let clainDuration = getIntegerValue(this, cd)
119119 let clainEnd = (clainStart + clainDuration)
120120 let price = getIntegerValue(this, p)
121121 if ((clainStart >= h))
122122 then throw("The Presale is still happening.")
123123 else if ((h > clainEnd))
124124 then {
125125 let getTInvest = valueOrErrorMessage(getIntegerValue(this, (tinvest + toBase58String(i.caller.bytes))), "You were not part of the presale")
126126 let calc = (getTInvest / price)
127127 let distri = (calc / clainDuration)
128128 let hSolicitatin = valueOrElse(getIntegerValue(this, ((tinvest + toBase58String(i.caller.bytes)) + "_HISTORY")), 0)
129129 let diferencH = (clainDuration - hSolicitatin)
130130 let finalValue = (distri * diferencH)
131131 [IntegerEntry(((tinvest + toBase58String(i.caller.bytes)) + "_HISTORY"), (h - clainStart)), IntegerEntry((tinvest + toBase58String(i.caller.bytes)), (getTInvest - (finalValue * price))), ScriptTransfer(i.caller, finalValue, mainAsset)]
132132 }
133133 else {
134134 let getTInvest = valueOrErrorMessage(getIntegerValue(this, (tinvest + toBase58String(i.caller.bytes))), "You were not part of the presale")
135135 let calc = (getTInvest / price)
136136 let distri = (calc / clainDuration)
137137 let hSolicitatin = valueOrElse(getIntegerValue(this, ((tinvest + toBase58String(i.caller.bytes)) + "_HISTORY")), 0)
138138 let diferencH = ((clainDuration - hSolicitatin) - (h - clainStart))
139139 let finalValue = (distri * diferencH)
140140 [IntegerEntry(((tinvest + toBase58String(i.caller.bytes)) + "_HISTORY"), (h - clainStart)), IntegerEntry((tinvest + toBase58String(i.caller.bytes)), (getTInvest - (finalValue * price))), ScriptTransfer(i.caller, finalValue, mainAsset)]
141141 }
142142 }
143143
144144
145145 @Verifier(tx)
146146 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
147147

github/deemru/w8io/026f985 
39.74 ms