tx · D4z7dwdLVriabLQwytQUEGdzXRvjQNGdoPSA5Feb4ka 3N34Zi5VD4m9az4kEXWDJngkMHMTpqLcoqo: -0.01400000 Waves 2021.10.14 12:36 [1745755] smart account 3N34Zi5VD4m9az4kEXWDJngkMHMTpqLcoqo > SELF 0.00000000 Waves
{ "type": 13, "id": "D4z7dwdLVriabLQwytQUEGdzXRvjQNGdoPSA5Feb4ka", "fee": 1400000, "feeAssetId": null, "timestamp": 1634204165531, "version": 2, "chainId": 84, "sender": "3N34Zi5VD4m9az4kEXWDJngkMHMTpqLcoqo", "senderPublicKey": "AmXrJ1inc5jpKhf6D9aDcRU8QWHZXBJdBBvz9VsKDe9x", "proofs": [ "MRGgYnA2FckvcVYnjteih7th91nnhPn8YX4F7HgTU4Q7RbZLJ1BuP2cyUtzrFwBX9WqaYf5CEJpPk8Lw73dDPaF" ], "script": "base64:AAIEAAAAAAAAAAkIAhIDCgEBEgAAAAAKAAAAAAtDT0RFQXNzZXRJRAEAAAAgkmB2qfKrqGeDE5s+bUmRW9TL3ErNp4dEODxuXgzu+JEAAAAAC1N0YXJ0SGVpZ2h0AAAAAAAAGqH4AAAAAAZvbmVkYXkAAAAAAAAABaAAAAAAD21pbmltdW1sb2NrZGF5cwAAAAAAAAAABgAAAAAPbWF4aW11bWxvY2tkYXlzAAAAAAAAAAAHAAAAAAlibG9ja2RpZmYJAABlAAAAAgUAAAAGaGVpZ2h0BQAAAAtTdGFydEhlaWdodAAAAAALSW5mbGF0aW9uTm8JAABkAAAAAgkAAGsAAAADAAAAAAJUC+QAAAAAAAAAAAABBQAAAAlibG9ja2RpZmYAAAAAAAAAF3AAAAAAC1N0YWtpbmdEYXBwAQAAACCjtaSeUVhAbk0T+akFnLGoDh+X4aR50o/42ilEuU4EFgAAAAAKRmVlQWRkcmVzcwEAAAAgUoPZoIvXkJI7M+XgQERyG3Ox4PxeH5gdLMWeskjH4iAAAAAACmRldkFkZHJlc3MBAAAAIHE/Oe1BrsJepSkes1ESh96Q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nR4AAAAD3NlbmRlclB1YmxpY0tleZ7ZNPU=", "height": 1745755, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FVpz14Ng6RHz1uoaoe8xomDYGgCPUSANaoWrnijKiv7L Next: BtzgpFskaDufiskqgYxyhGmQVmoQu7ZVsR4cUVbjf8Ej Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let CODEAssetID = base58' | |
4 | + | let CODEAssetID = base58'ArPqXguhFLjJt5XwcNwhXMnCv2zSumrM19y5WgT34yRi' | |
5 | 5 | ||
6 | 6 | let StartHeight = 1745400 | |
7 | 7 | ||
40 | 40 | let fetchuserstakeheight = valueOrErrorMessage(getInteger(addressFromPublicKey(StakingDapp), ("Deposit_height_Of_" + currentKey)), "Your Address not Found on Staking DApp") | |
41 | 41 | let fetchusermatureheight = valueOrErrorMessage(getInteger(addressFromPublicKey(StakingDapp), ("Total_Lock_Blocks_Of_" + currentKey)), "Your Address not Found on Staking DApp") | |
42 | 42 | let gapofheight = (fetchusermatureheight - fetchuserstakeheight) | |
43 | + | let StakedCODEAmount = match getInteger(this, "Staked_Amount") { | |
44 | + | case a: Int => | |
45 | + | a | |
46 | + | case _ => | |
47 | + | 0 | |
48 | + | } | |
49 | + | let newStakedCODEAmount = (StakedCODEAmount + pmt.amount) | |
50 | + | let currentCODEAmount = match getInteger(this, ("Deposit_Amount_Of_" + currentKey)) { | |
51 | + | case a: Int => | |
52 | + | a | |
53 | + | case _ => | |
54 | + | 0 | |
55 | + | } | |
56 | + | let newCODEAmount = (currentCODEAmount + pmt.amount) | |
43 | 57 | if ((StartHeight > height)) | |
44 | 58 | then throw((("DApp is Not Started Yet please Wait until " + toString((StartHeight - height))) + " blocks")) | |
45 | 59 | else if ((pmt.assetId != CODEAssetID)) | |
54 | 68 | then throw((("You can attach maximum " + toString(allowdedpymt)) + "/10^8 CODE.")) | |
55 | 69 | else if ((gapofheight != 129600)) | |
56 | 70 | then throw("You are Not Eligible to Mint CODE. It need minimum 90 Days Staking.") | |
57 | - | else [Burn(CODEAssetID, pmt.amount), IntegerEntry("Total_Issued_CODE:", TotalIssuedCODE), IntegerEntry("Total_Burned_CODE:", TotalBurnedCODE), IntegerEntry("Total_Txns:", TotalTxnsCODE), IntegerEntry("Inflation", InflationNo), IntegerEntry(("Deposit_height_Of_" + currentKey), height), IntegerEntry(("Total_Lock_Blocks_Of_" + currentKey), totallockblocks), IntegerEntry(("Claim_Amount_" + currentKey), UserClaimAmount), StringEntry("message", "<h1>CODE Issued Successfully!</h1><br>"), ScriptTransfer(i.caller, UserClaimAmount, CODEAssetID)] | |
71 | + | else [Burn(CODEAssetID, pmt.amount), IntegerEntry("Total_Issued_CODE:", TotalIssuedCODE), IntegerEntry("Total_Burned_CODE:", TotalBurnedCODE), IntegerEntry("Staked_Amount", newStakedCODEAmount), IntegerEntry("Total_Txns:", TotalTxnsCODE), IntegerEntry("Inflation", InflationNo), IntegerEntry(("Deposit_height_Of_" + currentKey), height), IntegerEntry(("Deposit_Amount_Of_" + currentKey), newCODEAmount), IntegerEntry(("Total_Lock_Blocks_Of_" + currentKey), totallockblocks), IntegerEntry(("Rewards_Of_" + currentKey), UserClaimAmount), StringEntry("message", "<h1>CODE Issued Successfully!</h1><br>")] | |
72 | + | } | |
73 | + | ||
74 | + | ||
75 | + | ||
76 | + | @Callable(i) | |
77 | + | func Withdraw () = { | |
78 | + | let currentKey = toBase58String(i.caller.bytes) | |
79 | + | let checkdepositvalue = getIntegerValue(this, ("Deposit_Amount_Of_" + currentKey)) | |
80 | + | let checkstakedvalue = getIntegerValue(this, "Staked_Amount") | |
81 | + | let newstakedvalue = (checkstakedvalue - checkdepositvalue) | |
82 | + | let fetchRewardData = getIntegerValue(this, "Total_CODE_Claimed:") | |
83 | + | let totalrewardclaimed = (fetchRewardData + getIntegerValue(this, ("Rewards_Of_" + currentKey))) | |
84 | + | if ((getIntegerValue(this, ("Total_Lock_Blocks_Of_" + currentKey)) > height)) | |
85 | + | then throw(((("Your " + toString(getIntegerValue(this, ("Deposit_Amount_Of_" + currentKey)))) + " CODE are Under Lock. Consider last 8 digits as value after Decimals. Token will be Unlocked after ") + toString((getIntegerValue(this, ("Total_Lock_Blocks_Of_" + currentKey)) - height)))) | |
86 | + | else if ((checkdepositvalue == 0)) | |
87 | + | then throw("You Have Already Withdraw your CODE Amount.") | |
88 | + | else [Reissue(CODEAssetID, getIntegerValue(this, ("Deposit_Amount_Of_" + currentKey)), true), IntegerEntry(("Deposit_height_Of_" + currentKey), 0), IntegerEntry("Staked_Amount", newstakedvalue), IntegerEntry(("Deposit_Amount_Of_" + currentKey), 0), IntegerEntry(("Total_Lock_Blocks_Of_" + currentKey), 0), StringEntry(("Lock_Status_Of_" + currentKey), "UNLOCK"), IntegerEntry(("Rewards_Of_" + currentKey), 0), IntegerEntry("Total_CODE_Claimed:", totalrewardclaimed)] | |
58 | 89 | } | |
59 | 90 | ||
60 | 91 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let CODEAssetID = base58' | |
4 | + | let CODEAssetID = base58'ArPqXguhFLjJt5XwcNwhXMnCv2zSumrM19y5WgT34yRi' | |
5 | 5 | ||
6 | 6 | let StartHeight = 1745400 | |
7 | 7 | ||
8 | 8 | let oneday = 1440 | |
9 | 9 | ||
10 | 10 | let minimumlockdays = 6 | |
11 | 11 | ||
12 | 12 | let maximumlockdays = 7 | |
13 | 13 | ||
14 | 14 | let blockdiff = (height - StartHeight) | |
15 | 15 | ||
16 | 16 | let InflationNo = (fraction(10000000000, 1, blockdiff) + 6000) | |
17 | 17 | ||
18 | 18 | let StakingDapp = base58'C246qxhuyo9DBk1pjMzEQSVAWmiqYupG2swGkxTeAvLV' | |
19 | 19 | ||
20 | 20 | let FeeAddress = base58'6Z73KxcX3sugpiStpSRXxKxTmWqCaLVwFeM6kwyiKVDR' | |
21 | 21 | ||
22 | 22 | let devAddress = base58'8d4zGuTjT3h67Z4DatzMXdXXW1GvoQhMTjwCGFxJuene' | |
23 | 23 | ||
24 | 24 | @Callable(i) | |
25 | 25 | func Deposit (days) = { | |
26 | 26 | let pmt = if ((size(i.payments) == 1)) | |
27 | 27 | then i.payments[0] | |
28 | 28 | else throw("No Payments Attached Please Attach CODE Asset Only.") | |
29 | 29 | let currentKey = toBase58String(i.caller.bytes) | |
30 | 30 | let UserClaimAmount = ((((InflationNo * pmt.amount) * days) / 365) / 1000) | |
31 | 31 | let allowdedpymt = (blockdiff * 100000) | |
32 | 32 | let actualblocks = (oneday * days) | |
33 | 33 | let totallockblocks = (height + actualblocks) | |
34 | 34 | let PreviousIssuedCODE = getIntegerValue(this, "Total_Issued_CODE:") | |
35 | 35 | let TotalIssuedCODE = (PreviousIssuedCODE + UserClaimAmount) | |
36 | 36 | let PreviousBurnedCODE = getIntegerValue(this, "Total_Burned_CODE:") | |
37 | 37 | let TotalBurnedCODE = (PreviousBurnedCODE + pmt.amount) | |
38 | 38 | let PreviousTxnsCODE = getIntegerValue(this, "Total_Txns:") | |
39 | 39 | let TotalTxnsCODE = (PreviousTxnsCODE + 1) | |
40 | 40 | let fetchuserstakeheight = valueOrErrorMessage(getInteger(addressFromPublicKey(StakingDapp), ("Deposit_height_Of_" + currentKey)), "Your Address not Found on Staking DApp") | |
41 | 41 | let fetchusermatureheight = valueOrErrorMessage(getInteger(addressFromPublicKey(StakingDapp), ("Total_Lock_Blocks_Of_" + currentKey)), "Your Address not Found on Staking DApp") | |
42 | 42 | let gapofheight = (fetchusermatureheight - fetchuserstakeheight) | |
43 | + | let StakedCODEAmount = match getInteger(this, "Staked_Amount") { | |
44 | + | case a: Int => | |
45 | + | a | |
46 | + | case _ => | |
47 | + | 0 | |
48 | + | } | |
49 | + | let newStakedCODEAmount = (StakedCODEAmount + pmt.amount) | |
50 | + | let currentCODEAmount = match getInteger(this, ("Deposit_Amount_Of_" + currentKey)) { | |
51 | + | case a: Int => | |
52 | + | a | |
53 | + | case _ => | |
54 | + | 0 | |
55 | + | } | |
56 | + | let newCODEAmount = (currentCODEAmount + pmt.amount) | |
43 | 57 | if ((StartHeight > height)) | |
44 | 58 | then throw((("DApp is Not Started Yet please Wait until " + toString((StartHeight - height))) + " blocks")) | |
45 | 59 | else if ((pmt.assetId != CODEAssetID)) | |
46 | 60 | then throw(("Incorrect asset attached, please attach " + toBase58String(CODEAssetID))) | |
47 | 61 | else if ((minimumlockdays >= days)) | |
48 | 62 | then throw(((("Choose Locking days in between " + toString((minimumlockdays + 1))) + " to ") + toString(maximumlockdays))) | |
49 | 63 | else if ((days > maximumlockdays)) | |
50 | 64 | then throw(((((("You Entered days to " + toString(days)) + ", Please Enter no. of days in between ") + toString((minimumlockdays + 1))) + " to ") + toString(maximumlockdays))) | |
51 | 65 | else if ((100000 > pmt.amount)) | |
52 | 66 | then throw("Please Attach minimum 0.001 CODE To Issue CODE Asset.") | |
53 | 67 | else if ((pmt.amount > allowdedpymt)) | |
54 | 68 | then throw((("You can attach maximum " + toString(allowdedpymt)) + "/10^8 CODE.")) | |
55 | 69 | else if ((gapofheight != 129600)) | |
56 | 70 | then throw("You are Not Eligible to Mint CODE. It need minimum 90 Days Staking.") | |
57 | - | else [Burn(CODEAssetID, pmt.amount), IntegerEntry("Total_Issued_CODE:", TotalIssuedCODE), IntegerEntry("Total_Burned_CODE:", TotalBurnedCODE), IntegerEntry("Total_Txns:", TotalTxnsCODE), IntegerEntry("Inflation", InflationNo), IntegerEntry(("Deposit_height_Of_" + currentKey), height), IntegerEntry(("Total_Lock_Blocks_Of_" + currentKey), totallockblocks), IntegerEntry(("Claim_Amount_" + currentKey), UserClaimAmount), StringEntry("message", "<h1>CODE Issued Successfully!</h1><br>"), ScriptTransfer(i.caller, UserClaimAmount, CODEAssetID)] | |
71 | + | else [Burn(CODEAssetID, pmt.amount), IntegerEntry("Total_Issued_CODE:", TotalIssuedCODE), IntegerEntry("Total_Burned_CODE:", TotalBurnedCODE), IntegerEntry("Staked_Amount", newStakedCODEAmount), IntegerEntry("Total_Txns:", TotalTxnsCODE), IntegerEntry("Inflation", InflationNo), IntegerEntry(("Deposit_height_Of_" + currentKey), height), IntegerEntry(("Deposit_Amount_Of_" + currentKey), newCODEAmount), IntegerEntry(("Total_Lock_Blocks_Of_" + currentKey), totallockblocks), IntegerEntry(("Rewards_Of_" + currentKey), UserClaimAmount), StringEntry("message", "<h1>CODE Issued Successfully!</h1><br>")] | |
72 | + | } | |
73 | + | ||
74 | + | ||
75 | + | ||
76 | + | @Callable(i) | |
77 | + | func Withdraw () = { | |
78 | + | let currentKey = toBase58String(i.caller.bytes) | |
79 | + | let checkdepositvalue = getIntegerValue(this, ("Deposit_Amount_Of_" + currentKey)) | |
80 | + | let checkstakedvalue = getIntegerValue(this, "Staked_Amount") | |
81 | + | let newstakedvalue = (checkstakedvalue - checkdepositvalue) | |
82 | + | let fetchRewardData = getIntegerValue(this, "Total_CODE_Claimed:") | |
83 | + | let totalrewardclaimed = (fetchRewardData + getIntegerValue(this, ("Rewards_Of_" + currentKey))) | |
84 | + | if ((getIntegerValue(this, ("Total_Lock_Blocks_Of_" + currentKey)) > height)) | |
85 | + | then throw(((("Your " + toString(getIntegerValue(this, ("Deposit_Amount_Of_" + currentKey)))) + " CODE are Under Lock. Consider last 8 digits as value after Decimals. Token will be Unlocked after ") + toString((getIntegerValue(this, ("Total_Lock_Blocks_Of_" + currentKey)) - height)))) | |
86 | + | else if ((checkdepositvalue == 0)) | |
87 | + | then throw("You Have Already Withdraw your CODE Amount.") | |
88 | + | else [Reissue(CODEAssetID, getIntegerValue(this, ("Deposit_Amount_Of_" + currentKey)), true), IntegerEntry(("Deposit_height_Of_" + currentKey), 0), IntegerEntry("Staked_Amount", newstakedvalue), IntegerEntry(("Deposit_Amount_Of_" + currentKey), 0), IntegerEntry(("Total_Lock_Blocks_Of_" + currentKey), 0), StringEntry(("Lock_Status_Of_" + currentKey), "UNLOCK"), IntegerEntry(("Rewards_Of_" + currentKey), 0), IntegerEntry("Total_CODE_Claimed:", totalrewardclaimed)] | |
58 | 89 | } | |
59 | 90 | ||
60 | 91 | ||
61 | 92 | @Verifier(tx) | |
62 | 93 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
63 | 94 |
github/deemru/w8io/169f3d6 26.64 ms ◑