tx · 2zAEnCMo4o9pQEm57rHWbZwV4pM2mF7PnUxD1L1hx8hS

3N8bfBHf85mChgxdRoTj11XEHHREfQmz6dw:  -0.01000000 Waves

2023.03.13 01:23 [2487412] smart account 3N8bfBHf85mChgxdRoTj11XEHHREfQmz6dw > SELF 0.00000000 Waves

{ "type": 13, "id": "2zAEnCMo4o9pQEm57rHWbZwV4pM2mF7PnUxD1L1hx8hS", "fee": 1000000, "feeAssetId": null, "timestamp": 1678659813067, "version": 2, "chainId": 84, "sender": "3N8bfBHf85mChgxdRoTj11XEHHREfQmz6dw", "senderPublicKey": "6G9zJtFnV938b3kA2t6HebP8i69A1NMGVQ5qQ78fF1FR", "proofs": [ "4HZvEdZGHaPRxwnSB9svcMeEsVMM8dCM8GrVRf3Mp46j4MhUonYUThzn2b1fcn3omEwzE1NngwDvZkTQ2ULWTC34" ], "script": "base64:AAIFAAAAAAAAACYIAhIDCgEIEgsKCQEBAQEICAgIARIAEgASBQoDAQgIEgUKAwEBAQAAABMAAAAAAnBzAgAAAA1QUkVTQUxFX1NUQVJUAAAAAAJwZAIAAAAQUFJFU0FMRV9EVVJBVElPTgAAAAACY3MCAAAAC0NMQUlNX1NUQVJUAAAAAAJjZAIAAAAOQ0xBSU1fRFVSQVRJT04AAAAAAXACAAAACVBSSUNFX0lETwAAAAAEcDFJRAIAAAAQUFJJQ0VfMV9BU1NFVF9JRAAAAAAKYWRtaW5FcnJvcgIAAAAuT25seSB0aGUgQWRtaW4gaXRzZWxmIGNhbiBpbnZva2UgdGhpcyBmdW5jdGlvbgAAAAAEcDJJRAIAAAAQUFJJQ0VfMl9BU1NFVF9JRAAAAAAEcDNJRAIAAAAQUFJJQ0VfM19BU1NFVF9JRAAAAAAEcDRJRAIAAAAQUFJJQ0VfNF9BU1NFVF9JRAAAAAADbWlhAgAAABFNSU5fQU1PVU5UX0lOVkVTVAAAAAAFbWFpbmECAAAACk1BSU5fQVNTRVQAAAAAB2ZvclNhbGUCAAAADlRPVEFMX0ZP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AAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleZ01PvI=", "height": 2487412, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: H1itMcQrnno3MgwxwkeD2oSusuYcVskDZvwrT8G334zp Next: kGvUWxe2yKtbURaYe33xr3PLryapsWWpjuvCryTf6en Diff:
OldNewDifferences
4040 func getAssetIfValid (assetId) = toBase58String(valueOrErrorMessage(value(assetInfo(fromBase58String(assetId))).id, (("Asset Id: " + assetId) + " is invalid.")))
4141
4242
43-let adminAddress = "3N1io5kDA3VhQyxrLyXtGaeLxoPtZfkAgEc"
43+@Callable(i)
44+func AddAdmin (address) = if ((i.caller.bytes == this.bytes))
45+ then [StringEntry("admin", address)]
46+ else throw(adminError)
4447
45-let Admin = Address(fromBase58String(adminAddress))
48+
4649
4750 @Callable(i)
4851 func constructor (presaleStart,presaleDuration,distributionDuration,price,price1AssetId58,price2AssetId58,price3AssetId58,price4AssetId58,minInvestAmount) = {
5154 let asset3 = getAssetIfValid(price3AssetId58)
5255 if (if ((i.caller == this))
5356 then true
54- else (i.caller.bytes == getBinaryValue(Admin, "admin")))
57+ else (i.caller.bytes == getBinaryValue(this, "admin")))
5558 then if ((presaleDuration >= presaleStart))
5659 then throw("PresaleDuration can't be bigger than PresaleStart")
5760 else if ((minInvestAmount > price))
7174 @Callable(i)
7275 func set () = if (if ((i.caller == this))
7376 then true
74- else (i.caller.bytes == getBinaryValue(Admin, "admin")))
77+ else (i.caller.bytes == getBinaryValue(this, "admin")))
7578 then if ((size(i.payments) != 1))
7679 then throw("exactly 1 payment must be attached")
7780 else [IntegerEntry(forSale, value(i.payments[0]).amount), BinaryEntry(maina, value(i.payments[0].assetId))]
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 adminError = "Only the Admin itself can invoke this function"
1717
1818 let p2ID = "PRICE_2_ASSET_ID"
1919
2020 let p3ID = "PRICE_3_ASSET_ID"
2121
2222 let p4ID = "PRICE_4_ASSET_ID"
2323
2424 let mia = "MIN_AMOUNT_INVEST"
2525
2626 let maina = "MAIN_ASSET"
2727
2828 let forSale = "TOTAL_FOR_SALE"
2929
3030 let totalSale = "TOTAL_SALE"
3131
3232 let tinvest = "TOTAL_INVEST_"
3333
3434 let disdu = "DISTRIBUTION_DURATION"
3535
3636 let D8 = 100000000
3737
3838 let D10 = 10000000000
3939
4040 func getAssetIfValid (assetId) = toBase58String(valueOrErrorMessage(value(assetInfo(fromBase58String(assetId))).id, (("Asset Id: " + assetId) + " is invalid.")))
4141
4242
43-let adminAddress = "3N1io5kDA3VhQyxrLyXtGaeLxoPtZfkAgEc"
43+@Callable(i)
44+func AddAdmin (address) = if ((i.caller.bytes == this.bytes))
45+ then [StringEntry("admin", address)]
46+ else throw(adminError)
4447
45-let Admin = Address(fromBase58String(adminAddress))
48+
4649
4750 @Callable(i)
4851 func constructor (presaleStart,presaleDuration,distributionDuration,price,price1AssetId58,price2AssetId58,price3AssetId58,price4AssetId58,minInvestAmount) = {
4952 let asset1 = getAssetIfValid(price1AssetId58)
5053 let asset2 = getAssetIfValid(price2AssetId58)
5154 let asset3 = getAssetIfValid(price3AssetId58)
5255 if (if ((i.caller == this))
5356 then true
54- else (i.caller.bytes == getBinaryValue(Admin, "admin")))
57+ else (i.caller.bytes == getBinaryValue(this, "admin")))
5558 then if ((presaleDuration >= presaleStart))
5659 then throw("PresaleDuration can't be bigger than PresaleStart")
5760 else if ((minInvestAmount > price))
5861 then throw("minInvestAmount can't be bigger than price")
5962 else if (if (if ((asset1 == asset2))
6063 then true
6164 else (asset1 == asset3))
6265 then true
6366 else (asset2 == asset3))
6467 then throw("Each Asset must be different from the other.")
6568 else [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)]
6669 else throw(adminError)
6770 }
6871
6972
7073
7174 @Callable(i)
7275 func set () = if (if ((i.caller == this))
7376 then true
74- else (i.caller.bytes == getBinaryValue(Admin, "admin")))
77+ else (i.caller.bytes == getBinaryValue(this, "admin")))
7578 then if ((size(i.payments) != 1))
7679 then throw("exactly 1 payment must be attached")
7780 else [IntegerEntry(forSale, value(i.payments[0]).amount), BinaryEntry(maina, value(i.payments[0].assetId))]
7881 else throw(adminError)
7982
8083
8184
8285 @Callable(i)
8386 func invest () = {
8487 let mainAsset = getBinaryValue(this, maina)
8588 let presaleStart = getIntegerValue(this, ps)
8689 let presaleDuration = getIntegerValue(this, pd)
8790 let presaleEnd = (presaleStart + presaleDuration)
8891 let price = getIntegerValue(this, p)
8992 let h = height
9093 let pmt = value(i.payments[0])
9194 let pmtAssetId = toBase58String(value(pmt.assetId))
9295 let pmtAmount = pmt.amount
9396 let asset1 = getStringValue(this, p1ID)
9497 let asset2 = getStringValue(this, p2ID)
9598 let asset3 = getStringValue(this, p3ID)
9699 let asset4 = getStringValue(this, p4ID)
97100 let totalSalee = getIntegerValue(this, totalSale)
98101 let forSalee = getIntegerValue(this, forSale)
99102 let minInvest = getIntegerValue(this, mia)
100103 if ((presaleStart >= h))
101104 then throw("presale has not been started yet")
102105 else if ((h >= presaleEnd))
103106 then throw("presale has been already ended")
104107 else if ((size(i.payments) != 1))
105108 then throw("exactly 1 payment is expected")
106109 else if (if (if (if ((pmtAssetId != asset1))
107110 then (pmtAssetId != asset2)
108111 else false)
109112 then (pmtAssetId != asset3)
110113 else false)
111114 then (pmtAssetId != asset4)
112115 else false)
113116 then throw(((("invalid payment asset id:" + pmtAssetId) + " Expected:") + asset1))
114117 else if ((totalSalee >= forSalee))
115118 then throw("Pre-sale asset has been - sold consider to use smaller payment")
116119 else if ((minInvest > pmtAmount))
117120 then throw("Amount less than the minimum to be invested.")
118121 else {
119122 let calc = ((pmtAmount / price) * D8)
120123 let asi = match getInteger(this, (tinvest + toBase58String(i.caller.bytes))) {
121124 case az: Int =>
122125 az
123126 case _ =>
124127 0
125128 }
126129 [ScriptTransfer(i.caller, calc, mainAsset), 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)]
127130 }
128131 }
129132
130133
131134
132135 @Callable(i)
133136 func adminV (Value,address,assetId) = if (if ((i.caller == this))
134137 then true
135138 else (i.caller == Address(getBinaryValue(this, "admin"))))
136139 then [ScriptTransfer(Address(fromBase58String(address)), Value, fromBase58String(assetId))]
137140 else throw(adminError)
138141
139142
140143
141144 @Callable(i)
142145 func time (presaleStart,presaleDuration,distributionDuration) = if (if ((i.caller == this))
143146 then true
144147 else (i.caller.bytes == getBinaryValue(this, "admin")))
145148 then if ((presaleDuration >= presaleStart))
146149 then throw("PresaleDuration can't be bigger than PresaleStart")
147150 else [IntegerEntry(ps, presaleStart), IntegerEntry(pd, presaleDuration), IntegerEntry(disdu, distributionDuration)]
148151 else throw(adminError)
149152
150153
151154 @Verifier(tx)
152155 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
153156

github/deemru/w8io/169f3d6 
52.24 ms