tx · 12fwpVRbQWHR5SK2n69N2w7uASeGUsMqxMHAUhRGWKZA

3N3PoX8z2Mvu5YbaqZmtyF3dRFjqvhRkB3M:  -0.01400000 Waves

2022.03.11 12:07 [1959082] smart account 3N3PoX8z2Mvu5YbaqZmtyF3dRFjqvhRkB3M > SELF 0.00000000 Waves

{ "type": 13, "id": "12fwpVRbQWHR5SK2n69N2w7uASeGUsMqxMHAUhRGWKZA", "fee": 1400000, "feeAssetId": null, "timestamp": 1646989633491, "version": 2, "chainId": 84, "sender": "3N3PoX8z2Mvu5YbaqZmtyF3dRFjqvhRkB3M", "senderPublicKey": "FWZMxrtn6KRrWMPXmQPqDg5eRzwB2YvHhMjMJpwnLmBi", "proofs": [ "532S2fnPgyWehhm9mG4RxA5jKQritRgRkaweRDQJ81vpqfVdQgpy1SENUHVpcCDsQMbfJDBxkbDPyQzQHnVw5Fi1" ], "script": "base64:AAIFAAAAAAAAABIIAhIFCgMBAQgSABIDCgEIEgAAAAAbAQAAABNrZXlNYW5hZ2VyUHVibGljS2V5AAAAAAIAAAAUJXNfX21hbmFnZXJQdWJsaWNLZXkBAAAAGmtleVBlbmRpbmdNYW5hZ2VyUHVibGljS2V5AAAAAAIAAAAbJXNfX3BlbmRpbmdNYW5hZ2VyUHVibGljS2V5AAAAAANTRVACAAAAAl9fAAAAABVJZHhDZmdDbGFpbVN0YXJ0QmxvY2sAAAAAAAAAAAEAAAAAGElkeENmZ0NsYWltVmVzdGluZ1BlcmlvZAAAAAAAAAAAAgAAAAASSWR4Q2ZnQ2xhaW1Bc3NldElkAAAAAAAAAAADAAAAABRJZHhDZmdDbGFpbUFzc2V0TXVsdAAAAAAAAAAABAAAAAAVSWR4Q2ZnQ2xhaW1Bc3NldE93bmVyAAAAAAAAAAAFAAAAABtJZHhDZmdDbGFpbUFzc2V0VG90YWxBbW91bnQAAAAAAAAAAAYAAAAAG0lkeFRvdGFsc1RvdGFsQ2xhaW1lZEFtb3VudAAAAAAAAAAAAQAAAAAYSWR4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ZXJpZnkAAAAABAAAAA90YXJnZXRQdWJsaWNLZXkEAAAAByRtYXRjaDAJAQAAABZtYW5hZ2VyUHVibGljS2V5T3JVbml0AAAAAAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAKQnl0ZVZlY3RvcgQAAAACcGsFAAAAByRtYXRjaDAFAAAAAnBrAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAARVbml0CAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5CQAAAgAAAAECAAAAC01hdGNoIGVycm9yCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAUAAAAPdGFyZ2V0UHVibGljS2V5AYzC+A==", "height": 1959082, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Dw5HPqqhBvepzspaCV3PuvhK4BHpbVxt84H7oiRYqVi8 Next: AjNaNjUcdHNiZL1L5xUPyHMWQFyNkZUC92DJ2drQi1yL Diff:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let SEP = "__"
5-
6-let scale8 = 100000000
7-
8-let poolStatsPriceKey = 4
9-
10-let idxPoolAddress = 1
11-
12-let idxPoolStatus = 2
13-
14-let idxPoolLPAssetId = 3
15-
16-let idxAmtAssetId = 4
17-
18-let idxPriceAssetId = 5
19-
20-let idxAmtAssetDcm = 6
21-
22-let idxPriceAssetDcm = 7
23-
24-let idxIAmtAssetId = 8
25-
26-let idxIPriceAssetId = 9
27-
28-let idxLPAssetDcm = 10
29-
30-let idxMatcherPublicKey = 11
31-
32-func keyRegisterPut (poolAddress,txId) = ((("%s%s%s__P__" + poolAddress) + "__") + txId)
33-
34-
35-func keyRegisterInvest (poolAddress,txId) = ((("%s%s%s__invest__" + poolAddress) + "__") + txId)
36-
37-
38-func keyPoolTotalAmtByAsset (poolAddress,assetId) = ((("%s%s%s__total__" + poolAddress) + "__") + assetId)
39-
40-
41-func keyFactoryContract () = "%s__factoryContract"
42-
43-
44-func keySlippageAmtPerAssetCumulative (poolAddress,assetId) = (((("%s%s%s__" + poolAddress) + "__") + assetId) + "__slippageCumulative")
45-
46-
47-func keyFactoryConfig () = "%s__factoryConfig"
48-
49-
50-func keyMappingPoolContractAddressToPoolAssets (poolContractAddress) = (("%s%s%s__" + poolContractAddress) + "__mappings__poolContract2PoolAssets")
51-
52-
53-func keyMappingsInternal2baseAssetId (internalBaseAsset) = ("%s%s%d__mappings__internal2baseAssetId__" + toString(internalBaseAsset))
54-
55-
56-func keyPoolConfig (iAmtAsset,iPriceAsset) = (((("%d%d%s__" + iAmtAsset) + "__") + iPriceAsset) + "__config")
57-
58-
59-func keyAllPoolsShutdown () = "%s__shutdown"
60-
61-
62-func keyPoolWeight (contractAddress) = ("%s%s__poolWeight__" + contractAddress)
63-
64-
654 func keyManagerPublicKey () = "%s__managerPublicKey"
665
676
687 func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey"
698
709
71-let factoryContract = addressFromStringValue(valueOrErrorMessage(getString(this, keyFactoryContract()), "No Factory Acc found."))
10+let SEP = "__"
7211
73-func convertAssetId (assetId) = if (!(isDefined(assetId)))
74- then "WAVES"
75- else assetId
12+let IdxCfgClaimStartBlock = 1
13+
14+let IdxCfgClaimVestingPeriod = 2
15+
16+let IdxCfgClaimAssetId = 3
17+
18+let IdxCfgClaimAssetMult = 4
19+
20+let IdxCfgClaimAssetOwner = 5
21+
22+let IdxCfgClaimAssetTotalAmount = 6
23+
24+let IdxTotalsTotalClaimedAmount = 1
25+
26+let IdxTotalsRemainingAmount = 2
27+
28+let IdxTotalsLastClaimedHeight = 3
29+
30+func getStringOrFail (key) = valueOrErrorMessage(getString(key), (("mandatory this." + key) + " is not defined"))
7631
7732
78-func dataPutActionInfo (inAssetId,inAssetAmt,txHeight,txTimestamp) = makeString(["%s%d%d%d", inAssetId, toString(inAssetAmt), toString(txHeight), toString(txTimestamp)], SEP)
33+func formatConfigString (claimStartBlock,vestingPeriod,assetIdBase58,assetMult,assetOwner,assetTotalAmt) = makeString(["%d%d%s%d%s%d%", claimStartBlock, vestingPeriod, assetIdBase58, assetMult, assetOwner, assetTotalAmt], SEP)
7934
8035
81-func dataInvestActionInfo (outAmountAssetAmt,outPriceAssetAmt,txHeight,txTimestamp) = makeString(["%d%d%d%d", toString(outAmountAssetAmt), toString(outPriceAssetAmt), toString(txHeight), toString(txTimestamp)], SEP)
36+func formatConfig (claimStartBlock,vestingPeriod,assetIdBase58,assetMult,claimAssetOwner,claimAssetTotalAmount) = formatConfigString(toString(claimStartBlock), toString(vestingPeriod), assetIdBase58, toString(assetMult), claimAssetOwner, toString(claimAssetTotalAmount))
8237
8338
84-func asString (val) = match val {
85- case valStr: String =>
86- valStr
87- case _ =>
88- throw("fail to cast into String")
89-}
39+func formatTotalsString (totalClaimedAmount,remainingAmountForClaim,lastClaimedHeight) = makeString(["%d%d%d", totalClaimedAmount, remainingAmountForClaim, lastClaimedHeight], SEP)
9040
9141
92-func toScale (amt,resScale,curScale) = fraction(amt, resScale, curScale)
42+func formatHistoryRecord (claimedAssetAmount,claimingBlocks,firstCalulationBlock,lastCalulationBlock) = makeString(["%d%d%d%d%d%d", toString(height), toString(lastBlock.timestamp), toString(claimedAssetAmount), toString(claimingBlocks), toString(firstCalulationBlock), toString(lastCalulationBlock)], SEP)
43+
44+
45+func keyConfig () = "%s__config"
46+
47+
48+func keyTotals () = "%s__totals"
49+
50+
51+func keyOperationHistoryRecord (type,userAddress,txId58) = makeString(["%s%s%s%s__history", type, userAddress, txId58], SEP)
52+
53+
54+func readConfigArray () = split(getStringOrFail(keyConfig()), SEP)
55+
56+
57+func readTotalsArray () = split(getStringOrFail(keyTotals()), SEP)
58+
59+
60+func TotalsEntry (key,origArray,claimedAmt,newLastClaimedHeight) = {
61+ let totalClaimedAmount = parseIntValue(origArray[IdxTotalsTotalClaimedAmount])
62+ let remainingAmount = parseIntValue(origArray[IdxTotalsRemainingAmount])
63+ let lastClaimedHeight = parseIntValue(origArray[IdxTotalsLastClaimedHeight])
64+ let newTotalClaimedAmount = (totalClaimedAmount + claimedAmt)
65+ let newRemainingAmount = (remainingAmount - claimedAmt)
66+ if ((0 > newRemainingAmount))
67+ then throw("invalid math")
68+ else StringEntry(key, formatTotalsString(toString(newTotalClaimedAmount), toString(newRemainingAmount), toString(newLastClaimedHeight)))
69+ }
70+
71+
72+func ClaimOperationHistoryEntry (userAddress,claimedAssetAmount,claimingBlocks,firstCalculationBlock,lastCalculationBlock,txId) = StringEntry(keyOperationHistoryRecord("claim", userAddress, toBase58String(txId)), formatHistoryRecord(claimedAssetAmount, claimingBlocks, firstCalculationBlock, lastCalculationBlock))
9373
9474
9575 func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) {
130110
131111
132112 @Callable(i)
133-func constructor (factoryContract) = {
134- let checkCaller = mustManager(i)
135- if ((checkCaller == checkCaller))
136- then [StringEntry(keyFactoryContract(), factoryContract)]
137- else throw("Strict value is not equal to itself.")
113+func constructor (claimStartBlock,vestingPeriodBlocks,beneficiaryAddress) = {
114+ let vestingEnd = (claimStartBlock + vestingPeriodBlocks)
115+ if (isDefined(getString(keyConfig())))
116+ then throw("already initialized")
117+ else if ((size(i.payments) != 1))
118+ then throw("exactly 1 payment must be attached")
119+ else if (("3N4Aib5iubWiGMzdTh6wWiVDVbo32oeVUmH" != toString(i.caller)))
120+ then throw("not authorized")
121+ else {
122+ let beneficiaryAddressParsed = valueOrErrorMessage(addressFromString(beneficiaryAddress), "Invalid beneficiarAddress passed")
123+ let pmt = value(i.payments[0])
124+ let claimAssetId = value(pmt.assetId)
125+ let claimAssetInfo = valueOrErrorMessage(assetInfo(claimAssetId), "fail to load ido asset info")
126+ let claimAssetId58 = toBase58String(claimAssetId)
127+ let claimAssetMult = pow(10, 0, claimAssetInfo.decimals, 0, 0, DOWN)
128+ let claimAssetAmount = pmt.amount
129+[StringEntry(keyConfig(), formatConfig(claimStartBlock, vestingPeriodBlocks, claimAssetId58, claimAssetMult, toString(beneficiaryAddressParsed), claimAssetAmount)), StringEntry(keyTotals(), formatTotalsString("0", toString(claimAssetAmount), "0"))]
130+ }
138131 }
139132
140133
141134
142135 @Callable(i)
143-func put () = {
144- let pool = toString(i.caller)
145- let pmtAmtAsset = value(i.payments[0])
146- let pmtAssetId = if (!(isDefined(pmtAmtAsset.assetId)))
147- then "WAVES"
148- else toBase58String(value(pmtAmtAsset.assetId))
149- let pmtAssetAmt = pmtAmtAsset.amount
150- let poolAssets = split(valueOrErrorMessage(getString(factoryContract, keyMappingPoolContractAddressToPoolAssets(pool)), "Invalid caller"), SEP)
151- let amountAssetId = parseIntValue(poolAssets[1])
152- let priceAssetId = parseIntValue(poolAssets[2])
153- let amountAsset = valueOrErrorMessage(getString(factoryContract, keyMappingsInternal2baseAssetId(amountAssetId)), "Cannot find asset")
154- let priceAsset = valueOrErrorMessage(getString(factoryContract, keyMappingsInternal2baseAssetId(priceAssetId)), "Cannot find asset")
155- let totalAmt = valueOrElse(getInteger(this, keyPoolTotalAmtByAsset(pool, pmtAssetId)), 0)
156- let cumulativeSlippageAmt = valueOrElse(getInteger(this, keySlippageAmtPerAssetCumulative(pool, pmtAssetId)), 0)
157-[StringEntry(keyRegisterPut(pool, toBase58String(i.transactionId)), dataPutActionInfo(pmtAssetId, pmtAssetAmt, height, lastBlock.timestamp)), IntegerEntry(keyPoolTotalAmtByAsset(pool, pmtAssetId), (totalAmt + pmtAssetAmt)), IntegerEntry(keySlippageAmtPerAssetCumulative(pool, pmtAssetId), (cumulativeSlippageAmt + pmtAssetAmt))]
158- }
159-
160-
161-
162-@Callable(i)
163-func invest (poolAddressStr) = {
164- let poolAddress = valueOrErrorMessage(addressFromString(poolAddressStr), "invalid pool address")
165- let poolAssets = split(valueOrErrorMessage(getString(factoryContract, keyMappingPoolContractAddressToPoolAssets(poolAddressStr)), "Invalid pool passed."), SEP)
166- let amId = valueOrErrorMessage(getString(factoryContract, keyMappingsInternal2baseAssetId(parseIntValue(poolAssets[1]))), "No asset mapping found")
167- let prId = valueOrErrorMessage(getString(factoryContract, keyMappingsInternal2baseAssetId(parseIntValue(poolAssets[2]))), "No asset mapping found")
168- let amBalance = valueOrElse(getInteger(this, keyPoolTotalAmtByAsset(poolAddressStr, amId)), 0)
169- let prBalance = valueOrElse(getInteger(this, keyPoolTotalAmtByAsset(poolAddressStr, prId)), 0)
170- let estByPrResult = invoke(poolAddress, "evaluatePutByPriceAssetREADONLY", [prBalance], nil)
171- let estByAmResult = invoke(poolAddress, "evaluatePutByAmountAssetREADONLY", [amBalance], nil)
172- let IdxEstAmAmount = 7
173- let IdxEstPrAmount = 8
174- let estAmAmt = valueOrErrorMessage(parseIntValue(split(asString(estByPrResult), SEP)[IdxEstAmAmount]), "fail to parse estimated amAsset amount")
175- let estPrAmt = valueOrErrorMessage(parseIntValue(split(asString(estByAmResult), SEP)[IdxEstPrAmount]), "fail to parse estimated prAsset amount")
176- let $t066436744 = if ((amBalance >= estAmAmt))
177- then $Tuple2(estAmAmt, prBalance)
178- else $Tuple2(amBalance, estPrAmt)
179- let amAmt = $t066436744._1
180- let prAmt = $t066436744._2
181- let amAssetId = if ((amId == "WAVES"))
182- then unit
183- else fromBase58String(amId)
184- let prAssetId = if ((prId == "WAVES"))
185- then unit
186- else fromBase58String(prId)
187- let lpPut = invoke(poolAddress, "putForFree", [1000], [AttachedPayment(amAssetId, amAmt), AttachedPayment(prAssetId, prAmt)])
188- if ((lpPut == lpPut))
189- then [StringEntry(keyRegisterInvest(poolAddressStr, toBase58String(i.transactionId)), dataInvestActionInfo(amAmt, prAmt, height, lastBlock.timestamp)), IntegerEntry(keyPoolTotalAmtByAsset(poolAddressStr, amId), (amBalance - amAmt)), IntegerEntry(keyPoolTotalAmtByAsset(poolAddressStr, prId), (prBalance - prAmt))]
190- else throw("Strict value is not equal to itself.")
136+func claim () = {
137+ let cfgArray = readConfigArray()
138+ let cfgClaimStartHeight = parseIntValue(cfgArray[IdxCfgClaimStartBlock])
139+ let cfgClaimDuration = parseIntValue(cfgArray[IdxCfgClaimVestingPeriod])
140+ let cfgClaimEnd = (cfgClaimStartHeight + cfgClaimDuration)
141+ let cfgClaimAssetId58 = cfgArray[IdxCfgClaimAssetId]
142+ let cfgClaimAssetOwner = cfgArray[IdxCfgClaimAssetOwner]
143+ let cfgClaimAssetTotalAmount = parseIntValue(cfgArray[IdxCfgClaimAssetTotalAmount])
144+ let userAddress = i.caller
145+ let userAddress58 = toString(userAddress)
146+ let origTotalsArray = readTotalsArray()
147+ let totalClaimedAmount = parseIntValue(origTotalsArray[IdxTotalsTotalClaimedAmount])
148+ let totalRemainingAmount = parseIntValue(origTotalsArray[IdxTotalsRemainingAmount])
149+ let lastClaimedHeight = parseIntValue(origTotalsArray[IdxTotalsLastClaimedHeight])
150+ if ((userAddress58 != cfgClaimAssetOwner))
151+ then throw("permissions denied")
152+ else if ((cfgClaimStartHeight > height))
153+ then throw(("Wait claim start block: " + toString(cfgClaimStartHeight)))
154+ else {
155+ let lastCalulationBlock = if ((height > cfgClaimEnd))
156+ then cfgClaimEnd
157+ else height
158+ let firstCalulationBlock = if ((lastClaimedHeight == 0))
159+ then cfgClaimStartHeight
160+ else lastClaimedHeight
161+ let claimingBlocks = (lastCalulationBlock - firstCalulationBlock)
162+ let claimingAssetAmount = fraction(cfgClaimAssetTotalAmount, claimingBlocks, cfgClaimDuration)
163+[ScriptTransfer(userAddress, claimingAssetAmount, fromBase58String(cfgClaimAssetId58)), TotalsEntry(keyTotals(), readTotalsArray(), claimingAssetAmount, lastCalulationBlock), ClaimOperationHistoryEntry(userAddress58, claimingAssetAmount, claimingBlocks, firstCalulationBlock, lastCalulationBlock, i.transactionId)]
164+ }
191165 }
192166
193167
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let SEP = "__"
5-
6-let scale8 = 100000000
7-
8-let poolStatsPriceKey = 4
9-
10-let idxPoolAddress = 1
11-
12-let idxPoolStatus = 2
13-
14-let idxPoolLPAssetId = 3
15-
16-let idxAmtAssetId = 4
17-
18-let idxPriceAssetId = 5
19-
20-let idxAmtAssetDcm = 6
21-
22-let idxPriceAssetDcm = 7
23-
24-let idxIAmtAssetId = 8
25-
26-let idxIPriceAssetId = 9
27-
28-let idxLPAssetDcm = 10
29-
30-let idxMatcherPublicKey = 11
31-
32-func keyRegisterPut (poolAddress,txId) = ((("%s%s%s__P__" + poolAddress) + "__") + txId)
33-
34-
35-func keyRegisterInvest (poolAddress,txId) = ((("%s%s%s__invest__" + poolAddress) + "__") + txId)
36-
37-
38-func keyPoolTotalAmtByAsset (poolAddress,assetId) = ((("%s%s%s__total__" + poolAddress) + "__") + assetId)
39-
40-
41-func keyFactoryContract () = "%s__factoryContract"
42-
43-
44-func keySlippageAmtPerAssetCumulative (poolAddress,assetId) = (((("%s%s%s__" + poolAddress) + "__") + assetId) + "__slippageCumulative")
45-
46-
47-func keyFactoryConfig () = "%s__factoryConfig"
48-
49-
50-func keyMappingPoolContractAddressToPoolAssets (poolContractAddress) = (("%s%s%s__" + poolContractAddress) + "__mappings__poolContract2PoolAssets")
51-
52-
53-func keyMappingsInternal2baseAssetId (internalBaseAsset) = ("%s%s%d__mappings__internal2baseAssetId__" + toString(internalBaseAsset))
54-
55-
56-func keyPoolConfig (iAmtAsset,iPriceAsset) = (((("%d%d%s__" + iAmtAsset) + "__") + iPriceAsset) + "__config")
57-
58-
59-func keyAllPoolsShutdown () = "%s__shutdown"
60-
61-
62-func keyPoolWeight (contractAddress) = ("%s%s__poolWeight__" + contractAddress)
63-
64-
654 func keyManagerPublicKey () = "%s__managerPublicKey"
665
676
687 func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey"
698
709
71-let factoryContract = addressFromStringValue(valueOrErrorMessage(getString(this, keyFactoryContract()), "No Factory Acc found."))
10+let SEP = "__"
7211
73-func convertAssetId (assetId) = if (!(isDefined(assetId)))
74- then "WAVES"
75- else assetId
12+let IdxCfgClaimStartBlock = 1
13+
14+let IdxCfgClaimVestingPeriod = 2
15+
16+let IdxCfgClaimAssetId = 3
17+
18+let IdxCfgClaimAssetMult = 4
19+
20+let IdxCfgClaimAssetOwner = 5
21+
22+let IdxCfgClaimAssetTotalAmount = 6
23+
24+let IdxTotalsTotalClaimedAmount = 1
25+
26+let IdxTotalsRemainingAmount = 2
27+
28+let IdxTotalsLastClaimedHeight = 3
29+
30+func getStringOrFail (key) = valueOrErrorMessage(getString(key), (("mandatory this." + key) + " is not defined"))
7631
7732
78-func dataPutActionInfo (inAssetId,inAssetAmt,txHeight,txTimestamp) = makeString(["%s%d%d%d", inAssetId, toString(inAssetAmt), toString(txHeight), toString(txTimestamp)], SEP)
33+func formatConfigString (claimStartBlock,vestingPeriod,assetIdBase58,assetMult,assetOwner,assetTotalAmt) = makeString(["%d%d%s%d%s%d%", claimStartBlock, vestingPeriod, assetIdBase58, assetMult, assetOwner, assetTotalAmt], SEP)
7934
8035
81-func dataInvestActionInfo (outAmountAssetAmt,outPriceAssetAmt,txHeight,txTimestamp) = makeString(["%d%d%d%d", toString(outAmountAssetAmt), toString(outPriceAssetAmt), toString(txHeight), toString(txTimestamp)], SEP)
36+func formatConfig (claimStartBlock,vestingPeriod,assetIdBase58,assetMult,claimAssetOwner,claimAssetTotalAmount) = formatConfigString(toString(claimStartBlock), toString(vestingPeriod), assetIdBase58, toString(assetMult), claimAssetOwner, toString(claimAssetTotalAmount))
8237
8338
84-func asString (val) = match val {
85- case valStr: String =>
86- valStr
87- case _ =>
88- throw("fail to cast into String")
89-}
39+func formatTotalsString (totalClaimedAmount,remainingAmountForClaim,lastClaimedHeight) = makeString(["%d%d%d", totalClaimedAmount, remainingAmountForClaim, lastClaimedHeight], SEP)
9040
9141
92-func toScale (amt,resScale,curScale) = fraction(amt, resScale, curScale)
42+func formatHistoryRecord (claimedAssetAmount,claimingBlocks,firstCalulationBlock,lastCalulationBlock) = makeString(["%d%d%d%d%d%d", toString(height), toString(lastBlock.timestamp), toString(claimedAssetAmount), toString(claimingBlocks), toString(firstCalulationBlock), toString(lastCalulationBlock)], SEP)
43+
44+
45+func keyConfig () = "%s__config"
46+
47+
48+func keyTotals () = "%s__totals"
49+
50+
51+func keyOperationHistoryRecord (type,userAddress,txId58) = makeString(["%s%s%s%s__history", type, userAddress, txId58], SEP)
52+
53+
54+func readConfigArray () = split(getStringOrFail(keyConfig()), SEP)
55+
56+
57+func readTotalsArray () = split(getStringOrFail(keyTotals()), SEP)
58+
59+
60+func TotalsEntry (key,origArray,claimedAmt,newLastClaimedHeight) = {
61+ let totalClaimedAmount = parseIntValue(origArray[IdxTotalsTotalClaimedAmount])
62+ let remainingAmount = parseIntValue(origArray[IdxTotalsRemainingAmount])
63+ let lastClaimedHeight = parseIntValue(origArray[IdxTotalsLastClaimedHeight])
64+ let newTotalClaimedAmount = (totalClaimedAmount + claimedAmt)
65+ let newRemainingAmount = (remainingAmount - claimedAmt)
66+ if ((0 > newRemainingAmount))
67+ then throw("invalid math")
68+ else StringEntry(key, formatTotalsString(toString(newTotalClaimedAmount), toString(newRemainingAmount), toString(newLastClaimedHeight)))
69+ }
70+
71+
72+func ClaimOperationHistoryEntry (userAddress,claimedAssetAmount,claimingBlocks,firstCalculationBlock,lastCalculationBlock,txId) = StringEntry(keyOperationHistoryRecord("claim", userAddress, toBase58String(txId)), formatHistoryRecord(claimedAssetAmount, claimingBlocks, firstCalculationBlock, lastCalculationBlock))
9373
9474
9575 func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) {
9676 case s: String =>
9777 fromBase58String(s)
9878 case _: Unit =>
9979 unit
10080 case _ =>
10181 throw("Match error")
10282 }
10383
10484
10585 func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) {
10686 case s: String =>
10787 fromBase58String(s)
10888 case _: Unit =>
10989 unit
11090 case _ =>
11191 throw("Match error")
11292 }
11393
11494
11595 func mustManager (i) = {
11696 let pd = throw("Permission denied")
11797 match managerPublicKeyOrUnit() {
11898 case pk: ByteVector =>
11999 if ((i.callerPublicKey == pk))
120100 then true
121101 else pd
122102 case _: Unit =>
123103 if ((i.caller == this))
124104 then true
125105 else pd
126106 case _ =>
127107 throw("Match error")
128108 }
129109 }
130110
131111
132112 @Callable(i)
133-func constructor (factoryContract) = {
134- let checkCaller = mustManager(i)
135- if ((checkCaller == checkCaller))
136- then [StringEntry(keyFactoryContract(), factoryContract)]
137- else throw("Strict value is not equal to itself.")
113+func constructor (claimStartBlock,vestingPeriodBlocks,beneficiaryAddress) = {
114+ let vestingEnd = (claimStartBlock + vestingPeriodBlocks)
115+ if (isDefined(getString(keyConfig())))
116+ then throw("already initialized")
117+ else if ((size(i.payments) != 1))
118+ then throw("exactly 1 payment must be attached")
119+ else if (("3N4Aib5iubWiGMzdTh6wWiVDVbo32oeVUmH" != toString(i.caller)))
120+ then throw("not authorized")
121+ else {
122+ let beneficiaryAddressParsed = valueOrErrorMessage(addressFromString(beneficiaryAddress), "Invalid beneficiarAddress passed")
123+ let pmt = value(i.payments[0])
124+ let claimAssetId = value(pmt.assetId)
125+ let claimAssetInfo = valueOrErrorMessage(assetInfo(claimAssetId), "fail to load ido asset info")
126+ let claimAssetId58 = toBase58String(claimAssetId)
127+ let claimAssetMult = pow(10, 0, claimAssetInfo.decimals, 0, 0, DOWN)
128+ let claimAssetAmount = pmt.amount
129+[StringEntry(keyConfig(), formatConfig(claimStartBlock, vestingPeriodBlocks, claimAssetId58, claimAssetMult, toString(beneficiaryAddressParsed), claimAssetAmount)), StringEntry(keyTotals(), formatTotalsString("0", toString(claimAssetAmount), "0"))]
130+ }
138131 }
139132
140133
141134
142135 @Callable(i)
143-func put () = {
144- let pool = toString(i.caller)
145- let pmtAmtAsset = value(i.payments[0])
146- let pmtAssetId = if (!(isDefined(pmtAmtAsset.assetId)))
147- then "WAVES"
148- else toBase58String(value(pmtAmtAsset.assetId))
149- let pmtAssetAmt = pmtAmtAsset.amount
150- let poolAssets = split(valueOrErrorMessage(getString(factoryContract, keyMappingPoolContractAddressToPoolAssets(pool)), "Invalid caller"), SEP)
151- let amountAssetId = parseIntValue(poolAssets[1])
152- let priceAssetId = parseIntValue(poolAssets[2])
153- let amountAsset = valueOrErrorMessage(getString(factoryContract, keyMappingsInternal2baseAssetId(amountAssetId)), "Cannot find asset")
154- let priceAsset = valueOrErrorMessage(getString(factoryContract, keyMappingsInternal2baseAssetId(priceAssetId)), "Cannot find asset")
155- let totalAmt = valueOrElse(getInteger(this, keyPoolTotalAmtByAsset(pool, pmtAssetId)), 0)
156- let cumulativeSlippageAmt = valueOrElse(getInteger(this, keySlippageAmtPerAssetCumulative(pool, pmtAssetId)), 0)
157-[StringEntry(keyRegisterPut(pool, toBase58String(i.transactionId)), dataPutActionInfo(pmtAssetId, pmtAssetAmt, height, lastBlock.timestamp)), IntegerEntry(keyPoolTotalAmtByAsset(pool, pmtAssetId), (totalAmt + pmtAssetAmt)), IntegerEntry(keySlippageAmtPerAssetCumulative(pool, pmtAssetId), (cumulativeSlippageAmt + pmtAssetAmt))]
158- }
159-
160-
161-
162-@Callable(i)
163-func invest (poolAddressStr) = {
164- let poolAddress = valueOrErrorMessage(addressFromString(poolAddressStr), "invalid pool address")
165- let poolAssets = split(valueOrErrorMessage(getString(factoryContract, keyMappingPoolContractAddressToPoolAssets(poolAddressStr)), "Invalid pool passed."), SEP)
166- let amId = valueOrErrorMessage(getString(factoryContract, keyMappingsInternal2baseAssetId(parseIntValue(poolAssets[1]))), "No asset mapping found")
167- let prId = valueOrErrorMessage(getString(factoryContract, keyMappingsInternal2baseAssetId(parseIntValue(poolAssets[2]))), "No asset mapping found")
168- let amBalance = valueOrElse(getInteger(this, keyPoolTotalAmtByAsset(poolAddressStr, amId)), 0)
169- let prBalance = valueOrElse(getInteger(this, keyPoolTotalAmtByAsset(poolAddressStr, prId)), 0)
170- let estByPrResult = invoke(poolAddress, "evaluatePutByPriceAssetREADONLY", [prBalance], nil)
171- let estByAmResult = invoke(poolAddress, "evaluatePutByAmountAssetREADONLY", [amBalance], nil)
172- let IdxEstAmAmount = 7
173- let IdxEstPrAmount = 8
174- let estAmAmt = valueOrErrorMessage(parseIntValue(split(asString(estByPrResult), SEP)[IdxEstAmAmount]), "fail to parse estimated amAsset amount")
175- let estPrAmt = valueOrErrorMessage(parseIntValue(split(asString(estByAmResult), SEP)[IdxEstPrAmount]), "fail to parse estimated prAsset amount")
176- let $t066436744 = if ((amBalance >= estAmAmt))
177- then $Tuple2(estAmAmt, prBalance)
178- else $Tuple2(amBalance, estPrAmt)
179- let amAmt = $t066436744._1
180- let prAmt = $t066436744._2
181- let amAssetId = if ((amId == "WAVES"))
182- then unit
183- else fromBase58String(amId)
184- let prAssetId = if ((prId == "WAVES"))
185- then unit
186- else fromBase58String(prId)
187- let lpPut = invoke(poolAddress, "putForFree", [1000], [AttachedPayment(amAssetId, amAmt), AttachedPayment(prAssetId, prAmt)])
188- if ((lpPut == lpPut))
189- then [StringEntry(keyRegisterInvest(poolAddressStr, toBase58String(i.transactionId)), dataInvestActionInfo(amAmt, prAmt, height, lastBlock.timestamp)), IntegerEntry(keyPoolTotalAmtByAsset(poolAddressStr, amId), (amBalance - amAmt)), IntegerEntry(keyPoolTotalAmtByAsset(poolAddressStr, prId), (prBalance - prAmt))]
190- else throw("Strict value is not equal to itself.")
136+func claim () = {
137+ let cfgArray = readConfigArray()
138+ let cfgClaimStartHeight = parseIntValue(cfgArray[IdxCfgClaimStartBlock])
139+ let cfgClaimDuration = parseIntValue(cfgArray[IdxCfgClaimVestingPeriod])
140+ let cfgClaimEnd = (cfgClaimStartHeight + cfgClaimDuration)
141+ let cfgClaimAssetId58 = cfgArray[IdxCfgClaimAssetId]
142+ let cfgClaimAssetOwner = cfgArray[IdxCfgClaimAssetOwner]
143+ let cfgClaimAssetTotalAmount = parseIntValue(cfgArray[IdxCfgClaimAssetTotalAmount])
144+ let userAddress = i.caller
145+ let userAddress58 = toString(userAddress)
146+ let origTotalsArray = readTotalsArray()
147+ let totalClaimedAmount = parseIntValue(origTotalsArray[IdxTotalsTotalClaimedAmount])
148+ let totalRemainingAmount = parseIntValue(origTotalsArray[IdxTotalsRemainingAmount])
149+ let lastClaimedHeight = parseIntValue(origTotalsArray[IdxTotalsLastClaimedHeight])
150+ if ((userAddress58 != cfgClaimAssetOwner))
151+ then throw("permissions denied")
152+ else if ((cfgClaimStartHeight > height))
153+ then throw(("Wait claim start block: " + toString(cfgClaimStartHeight)))
154+ else {
155+ let lastCalulationBlock = if ((height > cfgClaimEnd))
156+ then cfgClaimEnd
157+ else height
158+ let firstCalulationBlock = if ((lastClaimedHeight == 0))
159+ then cfgClaimStartHeight
160+ else lastClaimedHeight
161+ let claimingBlocks = (lastCalulationBlock - firstCalulationBlock)
162+ let claimingAssetAmount = fraction(cfgClaimAssetTotalAmount, claimingBlocks, cfgClaimDuration)
163+[ScriptTransfer(userAddress, claimingAssetAmount, fromBase58String(cfgClaimAssetId58)), TotalsEntry(keyTotals(), readTotalsArray(), claimingAssetAmount, lastCalulationBlock), ClaimOperationHistoryEntry(userAddress58, claimingAssetAmount, claimingBlocks, firstCalulationBlock, lastCalulationBlock, i.transactionId)]
164+ }
191165 }
192166
193167
194168
195169 @Callable(i)
196170 func setManager (pendingManagerPublicKey) = {
197171 let checkCaller = mustManager(i)
198172 if ((checkCaller == checkCaller))
199173 then {
200174 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
201175 if ((checkManagerPublicKey == checkManagerPublicKey))
202176 then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)]
203177 else throw("Strict value is not equal to itself.")
204178 }
205179 else throw("Strict value is not equal to itself.")
206180 }
207181
208182
209183
210184 @Callable(i)
211185 func confirmManager () = {
212186 let pm = pendingManagerPublicKeyOrUnit()
213187 let hasPM = if (isDefined(pm))
214188 then true
215189 else throw("No pending manager")
216190 if ((hasPM == hasPM))
217191 then {
218192 let checkPM = if ((i.callerPublicKey == value(pm)))
219193 then true
220194 else throw("You are not pending manager")
221195 if ((checkPM == checkPM))
222196 then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())]
223197 else throw("Strict value is not equal to itself.")
224198 }
225199 else throw("Strict value is not equal to itself.")
226200 }
227201
228202
229203 @Verifier(tx)
230204 func verify () = {
231205 let targetPublicKey = match managerPublicKeyOrUnit() {
232206 case pk: ByteVector =>
233207 pk
234208 case _: Unit =>
235209 tx.senderPublicKey
236210 case _ =>
237211 throw("Match error")
238212 }
239213 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
240214 }
241215

github/deemru/w8io/026f985 
53.69 ms