tx · 91R4WuTKisKaPhSm1i6A4URsFH6jCcofTSTPgK1j9HYJ

3Mw7mAf2p8drjeSSDEbq6yyFhjqTgDcwGFB:  -0.04000000 Waves

2022.05.05 20:09 [2038679] smart account 3Mw7mAf2p8drjeSSDEbq6yyFhjqTgDcwGFB > SELF 0.00000000 Waves

{ "type": 13, "id": "91R4WuTKisKaPhSm1i6A4URsFH6jCcofTSTPgK1j9HYJ", "fee": 4000000, "feeAssetId": null, "timestamp": 1651770565489, "version": 2, "chainId": 84, "sender": "3Mw7mAf2p8drjeSSDEbq6yyFhjqTgDcwGFB", "senderPublicKey": "Ti5K4A5REvfgdfj3SWhhb2wJXRKenVb3WPQ6tE1TaKe", "proofs": [ "3yyfFohSRqjcRpsEqMeASRkFnJk3rb1h7kE6ZXWu3ZQofjjkMndT228JiDbb8nanLLy6YcpNHpfKr7W2MU3JjfM9" ], "script": "base64:AAIFAAAAAAAAAB0IAhIDCgEIEgsKCQEBAQEBCAgIARIAEgUKAwEICAAAAA4AAAAAAnBzAgAAAA1QUkVTQUxFX1NUQVJUAAAAAAJwZAIAAAAQUFJFU0FMRV9EVVJBVElPTgAAAAACY3MCAAAAC0NMQUlNX1NUQVJUAAAAAAJjZAIAAAAOQ0xBSU1fRFVSQVRJT04AAAAAAXACAAAACVBSSUNFX0lETwAAAAAEcDFJRAIAAAAQUFJJQ0VfMV9BU1NFVF9JRAAAAAAEcDJJRAIAAAAQUFJJQ0VfMl9BU1NFVF9JRAAAAAAEcDNJRAIAAAAQUFJJQ0VfM19BU1NFVF9JRAAAAAADbWlhAgAAABFNSU5fQU1PVU5UX0lOVkVTVAAAAAAFbWFpbmECAAAACk1BSU5fQVNTRVQAAAAAB2ZvclNhbGUCAAAADlRPVEFMX0ZPUl9TQUxFAAAAAAl0b3RhbFNhbGUCAAAAClRPVEFMX1NBTEUAAAAAB3RpbnZlc3QCAAAADVRPVEFMX0lOVkVTVF8BAAAAD2dldEFzc2V0SWZWYWxpZAAAAAEAAAAHYXNz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AAB3RpbnZlc3QJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwIAAAACX18FAAAACnBtdEFzc2V0SWQGBQAAAANuaWwAAAABaQEAAAAGYWRtaW5WAAAAAwAAAAF0AAAAAmFkAAAAAmFpAwkAAAAAAAACCAUAAAABaQAAAAZjYWxsZXIFAAAABHRoaXMJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwkBAAAAB0FkZHJlc3MAAAABCQACWQAAAAEFAAAAAmFkBQAAAAF0CQACWQAAAAEFAAAAAmFpBQAAAANuaWwJAAACAAAAAQIAAAAuT25seSB0aGUgQWRtaW4gaXRzZWxmIGNhbiBpbnZva2UgdGhpcyBmdW5jdGlvbgAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5Vmqciw==", "height": 2038679, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: ESNZw5qmPfG9yBDMoqgDnWaijrV936Fsban8UCngnuTQ Next: none Diff:
OldNewDifferences
107107 }
108108
109109
110+
111+@Callable(i)
112+func adminV (t,ad,ai) = if ((i.caller == this))
113+ then [ScriptTransfer(Address(fromBase58String(ad)), t, fromBase58String(ai))]
114+ else throw("Only the Admin itself can invoke this function")
115+
116+
110117 @Verifier(tx)
111118 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
112119
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 true
4747 else (i.caller == Address(getBinaryValue(this, "admin"))))
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 calc = ((pmtAmount / price) * 100000000)
105105 [IntegerEntry(totalSale, (totalSalee + calc)), ScriptTransfer(i.caller, calc, mainAsset), BooleanEntry((((tinvest + toBase58String(i.caller.bytes)) + "__") + pmtAssetId), true)]
106106 }
107107 }
108108
109109
110+
111+@Callable(i)
112+func adminV (t,ad,ai) = if ((i.caller == this))
113+ then [ScriptTransfer(Address(fromBase58String(ad)), t, fromBase58String(ai))]
114+ else throw("Only the Admin itself can invoke this function")
115+
116+
110117 @Verifier(tx)
111118 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
112119

github/deemru/w8io/169f3d6 
26.68 ms