tx · 86btHPKWzbttB2Ruj2SuyeF18JdfDYpotPPsseyAHuuK 3NARdCrmQCEs9RNtwCSRc6JCoThQGyXjrAj: -0.01400000 Waves 2021.10.11 07:29 [1741130] smart account 3NARdCrmQCEs9RNtwCSRc6JCoThQGyXjrAj > SELF 0.00000000 Waves
{ "type": 13, "id": "86btHPKWzbttB2Ruj2SuyeF18JdfDYpotPPsseyAHuuK", "fee": 1400000, "feeAssetId": null, "timestamp": 1633926597159, "version": 2, "chainId": 84, "sender": "3NARdCrmQCEs9RNtwCSRc6JCoThQGyXjrAj", "senderPublicKey": "C246qxhuyo9DBk1pjMzEQSVAWmiqYupG2swGkxTeAvLV", "proofs": [ "4XfScBsPcAsaRUgTt4YX1VhpCPdwwCj57c3CCKcHMLu6RrPdAV6XjBJPcmGz2LHJ4bpjQZMARfg2cBWUJ2Ra1qku" ], "script": "base64:AAIEAAAAAAAAAAQIAhIAAAAABgAAAAALQ09ERUFzc2V0SUQBAAAAINAEYRpFnLQZXHk7APbo5tWij1YQ2cG3R/UN12TTTH73AAAAAAtTdGFydEhlaWdodAAAAAAAAAAAAAAAAAAJYmxvY2tkaWZmCQAAZQAAAAIFAAAABmhlaWdodAUAAAALU3RhcnRIZWlnaHQAAAAADlN0YXJ0SW5mbGF0aW9uCQAAZAAAAAIJAABrAAAAAwAAAAAAAJiWgAAAAAAAAAAAAQUAAAAJYmxvY2tkaWZmAAAAAAAAAAAGAAAAAApGZWVBZGRyZXNzAQAAACBSg9mgi9eQkjsz5eBARHIbc7Hg/F4fmB0sxZ6ySMfiIAAAAAAKZGV2QWRkcmVzcwEAAAAgcT857UGuwl6lKR6zURKH3pDKrZTlUMsXWQXYxcjWeBsAAAABAAAAAWkBAAAABUNsYWltAAAAAAQAAAADcG10AwkAAAAAAAACCQABkAAAAAEIBQAAAAFpAAAACHBheW1lbnRzAAAAAAAAAAABCQABkQAAAAIIBQAAAAFpAAAACHBheW1lbnRzAAAAAAAAAAAACQAAAgAAAAECAAAAM05vIF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VnZXJFbnRyeQAAAAICAAAAC1RvdGFsX1R4bnM6BQAAAA1Ub3RhbFR4bnNDT0RFCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACCQABLAAAAAICAAAADUNsYWltX0Ftb3VudF8FAAAACmN1cnJlbnRLZXkFAAAADU5ld0NPREVUb1VzZXIJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAICAAAAE1VzZXJfU3Rha2VkX0Ftb3VudDoFAAAAFmZldGNodXNlcnN0YWtlZGJsYW5hY2UJAARMAAAAAgkBAAAABEJ1cm4AAAACBQAAAAtDT0RFQXNzZXRJRAgFAAAAA3BtdAAAAAZhbW91bnQJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAA1OZXdDT0RFVG9Vc2VyBQAAAAtDT0RFQXNzZXRJRAkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACAgAAAAdtZXNzYWdlAgAAACY8aDE+Q09ERSBJc3N1ZWQgU3VjY2Vzc2Z1bGx5ITwvaDE+PGJyPgUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXl2RGVZ", "height": 1741130, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3jz8iZzHCMa3V2Rw5wHRHyRJWcGsLCjdmpYtDiZYiJhn Next: HZGTYHJuRj2YCeyLj7p8Zow1J3QpCKNRqKXCmjzyQNja Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let | |
4 | + | let CODEAssetID = base58'F11g74azdw3SZN83raygbu9useimfTwSQ7HmTLggAq26' | |
5 | 5 | ||
6 | - | let | |
6 | + | let StartHeight = 0 | |
7 | 7 | ||
8 | - | let CODEAssetID = base58'F11g74azdw3SZN83raygbu9useimfTwSQ7HmTLggAq26' | |
8 | + | let blockdiff = (height - StartHeight) | |
9 | + | ||
10 | + | let StartInflation = (fraction(10000000, 1, blockdiff) + 6) | |
9 | 11 | ||
10 | 12 | let FeeAddress = base58'6Z73KxcX3sugpiStpSRXxKxTmWqCaLVwFeM6kwyiKVDR' | |
11 | 13 | ||
12 | 14 | let devAddress = base58'8d4zGuTjT3h67Z4DatzMXdXXW1GvoQhMTjwCGFxJuene' | |
13 | 15 | ||
14 | 16 | @Callable(i) | |
15 | - | func IssueA4A () = { | |
16 | - | let pmt = value(i.payments[0]) | |
17 | - | let currentKey = toBase58String(i.caller.bytes) | |
18 | - | let PricePerA4A = getIntegerValue(this, "A4A/TN") | |
19 | - | let A4AHardCap = getIntegerValue(this, "A4AHardCap") | |
20 | - | let NewA4AToUser = fraction(100000, pmt.amount, PricePerA4A) | |
21 | - | let PreviousIssuedA4A = getIntegerValue(this, "Total_Issued_A4A:") | |
22 | - | let TotalIssuedA4A = (PreviousIssuedA4A + NewA4AToUser) | |
23 | - | let PendingMinting = (A4AHardCap - TotalIssuedA4A) | |
24 | - | let PreviousA4AReserveValue = getIntegerValue(this, "Total_A4A_Reserve_In_TN:") | |
25 | - | let A4AReserveValue = (PreviousA4AReserveValue + pmt.amount) | |
26 | - | let PreviousA4ABackupPrice = getIntegerValue(this, "A4A_Backup_Value_In_TN:") | |
27 | - | let A4ABackupPrice = fraction(100000, A4AReserveValue, TotalIssuedA4A) | |
28 | - | if (isDefined(pmt.assetId)) | |
29 | - | then throw("Incorrect asset attached, please attach TN.") | |
30 | - | else if ((5000000 > pmt.amount)) | |
31 | - | then throw("Please Attach minimum 0.05 TN To Issue A4A Asset.") | |
32 | - | else if ((TotalIssuedA4A > A4AHardCap)) | |
33 | - | then throw((((((("A4A Minting is about to reach the Hard Cap of " + toString(A4AHardCap)) + "/10^8 A4A. Please Reduce your Minting Order by ") + toString(PendingMinting)) + " or put ") + toString((A4AHardCap - PreviousIssuedA4A))) + "/10^8")) | |
34 | - | else [IntegerEntry("Total_Issued_A4A:", TotalIssuedA4A), IntegerEntry("Balance_Minting_A4A:", PendingMinting), IntegerEntry("Total_A4A_Reserve_In_TN:", A4AReserveValue), IntegerEntry("A4A_Backup_Value_In_TN:", A4ABackupPrice), StringEntry("message", "<h1>A4A Issued Successfully!</h1><br>"), Reissue(A4AAssetID, NewA4AToUser, true), ScriptTransfer(i.caller, ((NewA4AToUser * 990) / 1000), A4AAssetID), ScriptTransfer(addressFromPublicKey(FeeAddress), ((NewA4AToUser * 9) / 1000), A4AAssetID), ScriptTransfer(addressFromPublicKey(devAddress), ((NewA4AToUser * 1) / 1000), A4AAssetID)] | |
35 | - | } | |
36 | - | ||
37 | - | ||
38 | - | ||
39 | - | @Callable(i) | |
40 | - | func Liquidate () = { | |
41 | - | let currentKey = toBase58String(i.callerPublicKey) | |
42 | - | let pmt = value(i.payments[0]) | |
43 | - | let PreviousIssuedA4A = getIntegerValue(this, "Total_Issued_A4A:") | |
44 | - | let PreviousBurnedA4A = getIntegerValue(this, "Total_Burned_A4A:") | |
45 | - | let TotalIssuedA4A = (PreviousIssuedA4A - pmt.amount) | |
46 | - | let TotalBurnedA4A = (PreviousBurnedA4A + pmt.amount) | |
47 | - | let PreviousA4AReserveValue = getIntegerValue(this, "Total_A4A_Reserve_In_TN:") | |
48 | - | let PreviousA4ABackupPrice = getIntegerValue(this, "A4A_Backup_Value_In_TN:") | |
49 | - | let calculateburnvalue = fraction(PreviousA4ABackupPrice, pmt.amount, 100000) | |
50 | - | let A4AReserveValue = (PreviousA4AReserveValue - calculateburnvalue) | |
51 | - | let A4ABackupPrice = fraction(100000, A4AReserveValue, TotalIssuedA4A) | |
52 | - | if ((pmt.assetId != A4AAssetID)) | |
53 | - | then throw("Kindly Deposit Only 8hdsVCxPBVEmVUZyyX8Sd98Z9hU7Fny26W96sjKiTw8g (A4A).") | |
54 | - | else if ((100000 > pmt.amount)) | |
55 | - | then throw("Attach Amount must be greater than 0.001 A4A.") | |
56 | - | else [Burn(A4AAssetID, pmt.amount), IntegerEntry("Total_Issued_A4A:", TotalIssuedA4A), IntegerEntry("Total_Burned_A4A:", TotalBurnedA4A), IntegerEntry("Total_A4A_Reserve_In_TN:", A4AReserveValue), IntegerEntry("A4A_Backup_Value_In_TN:", A4ABackupPrice), StringEntry("message", "<h1>A4A Liquidated Successfully!</h1><br>"), ScriptTransfer(i.caller, ((calculateburnvalue * 990) / 1000), unit), ScriptTransfer(addressFromPublicKey(FeeAddress), ((calculateburnvalue * 9) / 1000), unit), ScriptTransfer(addressFromPublicKey(devAddress), ((calculateburnvalue * 1) / 1000), unit)] | |
57 | - | } | |
58 | - | ||
59 | - | ||
60 | - | ||
61 | - | @Callable(i) | |
62 | - | func Deposit (days) = { | |
17 | + | func Claim () = { | |
63 | 18 | let pmt = if ((size(i.payments) == 1)) | |
64 | 19 | then i.payments[0] | |
65 | - | else throw("No | |
20 | + | else throw("No Payments Attached Please Attach CODE Asset Only.") | |
66 | 21 | let currentKey = toBase58String(i.caller.bytes) | |
67 | - | let maximumlockdays = 90 | |
68 | - | let lockstatus = "LOCKED" | |
69 | - | let ULBT = 99999999999 | |
70 | - | let ULST = 599999999999 | |
71 | - | let ULGT = 1199999999999 | |
72 | - | let ULDT = 1200000000000 | |
73 | - | let oneday = 1440 | |
74 | - | let actualblocks = (oneday * days) | |
75 | - | let totallockblocks = (height + actualblocks) | |
76 | - | let Tier1 = 36000 | |
77 | - | let Tier1rewards = fraction(fraction((Tier1 * 2), pmt.amount, pow(10, 0, 8, 0, 0, UP)), actualblocks, pow(10, 0, 6, 0, 0, UP)) | |
78 | - | let Tier2rewards = fraction(fraction((Tier1 * 4), pmt.amount, pow(10, 0, 8, 0, 0, UP)), actualblocks, pow(10, 0, 6, 0, 0, UP)) | |
79 | - | let Tier3rewards = fraction(fraction((Tier1 * 8), pmt.amount, pow(10, 0, 8, 0, 0, UP)), actualblocks, pow(10, 0, 6, 0, 0, UP)) | |
80 | - | let StakedA4AAmount = match getInteger(this, "Staked_Amount") { | |
81 | - | case a: Int => | |
82 | - | a | |
83 | - | case _ => | |
84 | - | 0 | |
85 | - | } | |
86 | - | let newStakedA4AAmount = (StakedA4AAmount + pmt.amount) | |
87 | - | let currentA4AAmount = match getInteger(this, ("Deposit_Amount_Of_" + currentKey)) { | |
88 | - | case a: Int => | |
89 | - | a | |
90 | - | case _ => | |
91 | - | 0 | |
92 | - | } | |
93 | - | let newA4AAmount = (currentA4AAmount + pmt.amount) | |
94 | - | if ((pmt.assetId != A4AAssetID)) | |
95 | - | then throw((("Incorrect asset attached, please attach " + toBase58String(A4AAssetID)) + " only.")) | |
96 | - | else if ((6 >= days)) | |
97 | - | then throw("Choose Locking days in between 7 to 90.") | |
98 | - | else if ((days > maximumlockdays)) | |
99 | - | then throw("You Entered days greater than 90 please Enter no. of days in between 7 to 90.") | |
100 | - | else if ((33300000000 > pmt.amount)) | |
101 | - | then throw("Please Attach minimum 333 A4A To Achieve BRONZE TIER.") | |
102 | - | else if ((ULBT >= pmt.amount)) | |
103 | - | then [StringEntry(("Tier_Of_" + currentKey), "BRONZE"), IntegerEntry(("Deposit_height_Of_" + currentKey), height), IntegerEntry("Staked_Amount", newStakedA4AAmount), IntegerEntry(("Deposit_Amount_Of_" + currentKey), newA4AAmount), IntegerEntry(("Total_Lock_Blocks_Of_" + currentKey), totallockblocks), StringEntry(("Lock_Status_Of_" + currentKey), lockstatus), IntegerEntry(("Rewards_Of_" + currentKey), fraction(fraction(Tier1, pmt.amount, pow(10, 0, 8, 0, 0, UP)), actualblocks, pow(10, 0, 6, 0, 0, UP)))] | |
104 | - | else if ((ULST >= pmt.amount)) | |
105 | - | then [StringEntry(("Tier_Of_" + currentKey), "SILVER"), IntegerEntry(("Deposit_height_Of_" + currentKey), height), IntegerEntry("Staked_Amount", newStakedA4AAmount), IntegerEntry(("Deposit_Amount_Of_" + currentKey), newA4AAmount), IntegerEntry(("Total_Lock_Blocks_Of_" + currentKey), totallockblocks), StringEntry(("Lock_Status_Of_" + currentKey), lockstatus), IntegerEntry(("Rewards_Of_" + currentKey), Tier1rewards)] | |
106 | - | else if ((ULGT >= pmt.amount)) | |
107 | - | then [StringEntry(("Tier_Of_" + currentKey), "GOLD"), IntegerEntry(("Deposit_height_Of_" + currentKey), height), IntegerEntry("Staked_Amount", newStakedA4AAmount), IntegerEntry(("Deposit_Amount_Of_" + currentKey), newA4AAmount), IntegerEntry(("Total_Lock_Blocks_Of_" + currentKey), totallockblocks), StringEntry(("Lock_Status_Of_" + currentKey), lockstatus), IntegerEntry(("Rewards_Of_" + currentKey), Tier2rewards)] | |
108 | - | else if ((ULDT == pmt.amount)) | |
109 | - | then [StringEntry(("Tier_Of_" + currentKey), "DIAMOND"), IntegerEntry(("Deposit_height_Of_" + currentKey), height), IntegerEntry("Staked_Amount", newStakedA4AAmount), IntegerEntry(("Deposit_Amount_Of_" + currentKey), newA4AAmount), IntegerEntry(("Total_Lock_Blocks_Of_" + currentKey), totallockblocks), StringEntry(("Lock_Status_Of_" + currentKey), lockstatus), IntegerEntry(("Rewards_Of_" + currentKey), Tier3rewards)] | |
110 | - | else throw("Please Choose a Range Between 333-12000.") | |
111 | - | } | |
112 | - | ||
113 | - | ||
114 | - | ||
115 | - | @Callable(i) | |
116 | - | func Withdraw () = { | |
117 | - | let currentKey = toBase58String(i.caller.bytes) | |
118 | - | let checkdepositvalue = getIntegerValue(this, ("Deposit_Amount_Of_" + currentKey)) | |
119 | - | let checkstakedvalue = getIntegerValue(this, "Staked_Amount") | |
120 | - | let newstakedvalue = (checkstakedvalue - checkdepositvalue) | |
121 | - | let check90Dgap = (getIntegerValue(this, ("Total_Lock_Blocks_Of_" + currentKey)) - getIntegerValue(this, ("Deposit_height_Of_" + currentKey))) | |
122 | - | let fetchRewardData = getIntegerValue(this, "Total_USDT_Claimed:") | |
123 | - | let totalrewardclaimed = (fetchRewardData + getIntegerValue(this, ("Rewards_Of_" + currentKey))) | |
124 | - | if ((getIntegerValue(this, ("Total_Lock_Blocks_Of_" + currentKey)) > height)) | |
125 | - | then throw(((("Your " + toString(getIntegerValue(this, ("Deposit_Amount_Of_" + currentKey)))) + " A4A 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)))) | |
126 | - | else if ((checkdepositvalue == 0)) | |
127 | - | then throw("You Have Already Withdraw your Amount.") | |
128 | - | else if ((check90Dgap == 129600)) | |
129 | - | then [ScriptTransfer(i.caller, getIntegerValue(this, ("Deposit_Amount_Of_" + currentKey)), A4AAssetID), ScriptTransfer(i.caller, getIntegerValue(this, ("Rewards_Of_" + currentKey)), USDTAssetID), ScriptTransfer(i.caller, ((getIntegerValue(this, ("Deposit_Amount_Of_" + currentKey)) * 3) / 1000), CODEAssetID), StringEntry(("Tier_Of_" + currentKey), "NONE"), 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_USDT_Claimed:", totalrewardclaimed)] | |
130 | - | else [ScriptTransfer(i.caller, getIntegerValue(this, ("Deposit_Amount_Of_" + currentKey)), A4AAssetID), ScriptTransfer(i.caller, getIntegerValue(this, ("Rewards_Of_" + currentKey)), USDTAssetID), StringEntry(("Tier_Of_" + currentKey), "NONE"), 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_USDT_Claimed:", totalrewardclaimed)] | |
131 | - | } | |
132 | - | ||
133 | - | ||
134 | - | ||
135 | - | @Callable(i) | |
136 | - | func DepositUSDT () = { | |
137 | - | let pmt = if ((size(i.payments) == 1)) | |
138 | - | then i.payments[0] | |
139 | - | else throw("No payment attached, Please Attach USDT Token in payment[1].") | |
140 | - | let calleraddress = toBase58String(i.caller.bytes) | |
141 | - | let USDTdepositor = getStringValue(this, "Funding_Address") | |
142 | - | let fetcholdUSDTbal = getIntegerValue(this, "USDT_Balance") | |
143 | - | let oldUSDTbal = match getInteger(this, "USDT_Balance") { | |
144 | - | case a: Int => | |
145 | - | a | |
146 | - | case _ => | |
147 | - | 0 | |
148 | - | } | |
149 | - | let newUSDTbal = (oldUSDTbal + pmt.amount) | |
150 | - | if ((USDTdepositor != calleraddress)) | |
151 | - | then throw((("I know You are not An Admin. Only " + USDTdepositor) + " has rights to add USDT Funds.")) | |
152 | - | else if ((pmt.assetId != USDTAssetID)) | |
153 | - | then throw((("Kindly Deposit Only USDT " + toBase58String(USDTAssetID)) + " AssetID.")) | |
154 | - | else if ((1000000 > pmt.amount)) | |
155 | - | then throw("Attach minimum 1 USDT atleast For Payment.") | |
156 | - | else [IntegerEntry("USDT_Balance", newUSDTbal)] | |
22 | + | let allowdedpymt = (blockdiff * 100000) | |
23 | + | let NewCODEToUser = (StartInflation * pmt.amount) | |
24 | + | let PreviousIssuedCODE = getIntegerValue(this, "Total_Issued_CODE:") | |
25 | + | let TotalIssuedCODE = (PreviousIssuedCODE + NewCODEToUser) | |
26 | + | let PreviousBurnedCODE = getIntegerValue(this, "Total_Burned_CODE:") | |
27 | + | let TotalBurnedCODE = (PreviousBurnedCODE + pmt.amount) | |
28 | + | let PreviousTxnsCODE = getIntegerValue(this, "Total_Txns:") | |
29 | + | let TotalTxnsCODE = (PreviousTxnsCODE + 1) | |
30 | + | let fetchuserstakedblanace = valueOrErrorMessage(getIntegerValue(addressFromPublicKey(base58'C246qxhuyo9DBk1pjMzEQSVAWmiqYupG2swGkxTeAvLV'), ("Deposit_Amount_Of_" + currentKey)), "Address not Found") | |
31 | + | if ((StartHeight > height)) | |
32 | + | then throw((("DApp is Not Started Yet please Wait until " + toString((StartHeight - height))) + " blocks")) | |
33 | + | else if ((pmt.assetId != CODEAssetID)) | |
34 | + | then throw(("Incorrect asset attached, please attach " + toBase58String(CODEAssetID))) | |
35 | + | else if ((100000 > pmt.amount)) | |
36 | + | then throw("Please Attach minimum 0.001 CODE To Issue CODE Asset.") | |
37 | + | else if ((pmt.amount > allowdedpymt)) | |
38 | + | then throw((("You can attach maximum " + toString(allowdedpymt)) + "/10^8 CODE.")) | |
39 | + | else [IntegerEntry("Inflation", StartInflation), IntegerEntry("Total_Issued_CODE:", TotalIssuedCODE), IntegerEntry("Total_Burned_CODE:", TotalBurnedCODE), IntegerEntry("Total_Txns:", TotalTxnsCODE), IntegerEntry(("Claim_Amount_" + currentKey), NewCODEToUser), IntegerEntry("User_Staked_Amount:", fetchuserstakedblanace), Burn(CODEAssetID, pmt.amount), ScriptTransfer(i.caller, NewCODEToUser, CODEAssetID), StringEntry("message", "<h1>CODE Issued Successfully!</h1><br>")] | |
157 | 40 | } | |
158 | 41 | ||
159 | 42 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let | |
4 | + | let CODEAssetID = base58'F11g74azdw3SZN83raygbu9useimfTwSQ7HmTLggAq26' | |
5 | 5 | ||
6 | - | let | |
6 | + | let StartHeight = 0 | |
7 | 7 | ||
8 | - | let CODEAssetID = base58'F11g74azdw3SZN83raygbu9useimfTwSQ7HmTLggAq26' | |
8 | + | let blockdiff = (height - StartHeight) | |
9 | + | ||
10 | + | let StartInflation = (fraction(10000000, 1, blockdiff) + 6) | |
9 | 11 | ||
10 | 12 | let FeeAddress = base58'6Z73KxcX3sugpiStpSRXxKxTmWqCaLVwFeM6kwyiKVDR' | |
11 | 13 | ||
12 | 14 | let devAddress = base58'8d4zGuTjT3h67Z4DatzMXdXXW1GvoQhMTjwCGFxJuene' | |
13 | 15 | ||
14 | 16 | @Callable(i) | |
15 | - | func IssueA4A () = { | |
16 | - | let pmt = value(i.payments[0]) | |
17 | - | let currentKey = toBase58String(i.caller.bytes) | |
18 | - | let PricePerA4A = getIntegerValue(this, "A4A/TN") | |
19 | - | let A4AHardCap = getIntegerValue(this, "A4AHardCap") | |
20 | - | let NewA4AToUser = fraction(100000, pmt.amount, PricePerA4A) | |
21 | - | let PreviousIssuedA4A = getIntegerValue(this, "Total_Issued_A4A:") | |
22 | - | let TotalIssuedA4A = (PreviousIssuedA4A + NewA4AToUser) | |
23 | - | let PendingMinting = (A4AHardCap - TotalIssuedA4A) | |
24 | - | let PreviousA4AReserveValue = getIntegerValue(this, "Total_A4A_Reserve_In_TN:") | |
25 | - | let A4AReserveValue = (PreviousA4AReserveValue + pmt.amount) | |
26 | - | let PreviousA4ABackupPrice = getIntegerValue(this, "A4A_Backup_Value_In_TN:") | |
27 | - | let A4ABackupPrice = fraction(100000, A4AReserveValue, TotalIssuedA4A) | |
28 | - | if (isDefined(pmt.assetId)) | |
29 | - | then throw("Incorrect asset attached, please attach TN.") | |
30 | - | else if ((5000000 > pmt.amount)) | |
31 | - | then throw("Please Attach minimum 0.05 TN To Issue A4A Asset.") | |
32 | - | else if ((TotalIssuedA4A > A4AHardCap)) | |
33 | - | then throw((((((("A4A Minting is about to reach the Hard Cap of " + toString(A4AHardCap)) + "/10^8 A4A. Please Reduce your Minting Order by ") + toString(PendingMinting)) + " or put ") + toString((A4AHardCap - PreviousIssuedA4A))) + "/10^8")) | |
34 | - | else [IntegerEntry("Total_Issued_A4A:", TotalIssuedA4A), IntegerEntry("Balance_Minting_A4A:", PendingMinting), IntegerEntry("Total_A4A_Reserve_In_TN:", A4AReserveValue), IntegerEntry("A4A_Backup_Value_In_TN:", A4ABackupPrice), StringEntry("message", "<h1>A4A Issued Successfully!</h1><br>"), Reissue(A4AAssetID, NewA4AToUser, true), ScriptTransfer(i.caller, ((NewA4AToUser * 990) / 1000), A4AAssetID), ScriptTransfer(addressFromPublicKey(FeeAddress), ((NewA4AToUser * 9) / 1000), A4AAssetID), ScriptTransfer(addressFromPublicKey(devAddress), ((NewA4AToUser * 1) / 1000), A4AAssetID)] | |
35 | - | } | |
36 | - | ||
37 | - | ||
38 | - | ||
39 | - | @Callable(i) | |
40 | - | func Liquidate () = { | |
41 | - | let currentKey = toBase58String(i.callerPublicKey) | |
42 | - | let pmt = value(i.payments[0]) | |
43 | - | let PreviousIssuedA4A = getIntegerValue(this, "Total_Issued_A4A:") | |
44 | - | let PreviousBurnedA4A = getIntegerValue(this, "Total_Burned_A4A:") | |
45 | - | let TotalIssuedA4A = (PreviousIssuedA4A - pmt.amount) | |
46 | - | let TotalBurnedA4A = (PreviousBurnedA4A + pmt.amount) | |
47 | - | let PreviousA4AReserveValue = getIntegerValue(this, "Total_A4A_Reserve_In_TN:") | |
48 | - | let PreviousA4ABackupPrice = getIntegerValue(this, "A4A_Backup_Value_In_TN:") | |
49 | - | let calculateburnvalue = fraction(PreviousA4ABackupPrice, pmt.amount, 100000) | |
50 | - | let A4AReserveValue = (PreviousA4AReserveValue - calculateburnvalue) | |
51 | - | let A4ABackupPrice = fraction(100000, A4AReserveValue, TotalIssuedA4A) | |
52 | - | if ((pmt.assetId != A4AAssetID)) | |
53 | - | then throw("Kindly Deposit Only 8hdsVCxPBVEmVUZyyX8Sd98Z9hU7Fny26W96sjKiTw8g (A4A).") | |
54 | - | else if ((100000 > pmt.amount)) | |
55 | - | then throw("Attach Amount must be greater than 0.001 A4A.") | |
56 | - | else [Burn(A4AAssetID, pmt.amount), IntegerEntry("Total_Issued_A4A:", TotalIssuedA4A), IntegerEntry("Total_Burned_A4A:", TotalBurnedA4A), IntegerEntry("Total_A4A_Reserve_In_TN:", A4AReserveValue), IntegerEntry("A4A_Backup_Value_In_TN:", A4ABackupPrice), StringEntry("message", "<h1>A4A Liquidated Successfully!</h1><br>"), ScriptTransfer(i.caller, ((calculateburnvalue * 990) / 1000), unit), ScriptTransfer(addressFromPublicKey(FeeAddress), ((calculateburnvalue * 9) / 1000), unit), ScriptTransfer(addressFromPublicKey(devAddress), ((calculateburnvalue * 1) / 1000), unit)] | |
57 | - | } | |
58 | - | ||
59 | - | ||
60 | - | ||
61 | - | @Callable(i) | |
62 | - | func Deposit (days) = { | |
17 | + | func Claim () = { | |
63 | 18 | let pmt = if ((size(i.payments) == 1)) | |
64 | 19 | then i.payments[0] | |
65 | - | else throw("No | |
20 | + | else throw("No Payments Attached Please Attach CODE Asset Only.") | |
66 | 21 | let currentKey = toBase58String(i.caller.bytes) | |
67 | - | let maximumlockdays = 90 | |
68 | - | let lockstatus = "LOCKED" | |
69 | - | let ULBT = 99999999999 | |
70 | - | let ULST = 599999999999 | |
71 | - | let ULGT = 1199999999999 | |
72 | - | let ULDT = 1200000000000 | |
73 | - | let oneday = 1440 | |
74 | - | let actualblocks = (oneday * days) | |
75 | - | let totallockblocks = (height + actualblocks) | |
76 | - | let Tier1 = 36000 | |
77 | - | let Tier1rewards = fraction(fraction((Tier1 * 2), pmt.amount, pow(10, 0, 8, 0, 0, UP)), actualblocks, pow(10, 0, 6, 0, 0, UP)) | |
78 | - | let Tier2rewards = fraction(fraction((Tier1 * 4), pmt.amount, pow(10, 0, 8, 0, 0, UP)), actualblocks, pow(10, 0, 6, 0, 0, UP)) | |
79 | - | let Tier3rewards = fraction(fraction((Tier1 * 8), pmt.amount, pow(10, 0, 8, 0, 0, UP)), actualblocks, pow(10, 0, 6, 0, 0, UP)) | |
80 | - | let StakedA4AAmount = match getInteger(this, "Staked_Amount") { | |
81 | - | case a: Int => | |
82 | - | a | |
83 | - | case _ => | |
84 | - | 0 | |
85 | - | } | |
86 | - | let newStakedA4AAmount = (StakedA4AAmount + pmt.amount) | |
87 | - | let currentA4AAmount = match getInteger(this, ("Deposit_Amount_Of_" + currentKey)) { | |
88 | - | case a: Int => | |
89 | - | a | |
90 | - | case _ => | |
91 | - | 0 | |
92 | - | } | |
93 | - | let newA4AAmount = (currentA4AAmount + pmt.amount) | |
94 | - | if ((pmt.assetId != A4AAssetID)) | |
95 | - | then throw((("Incorrect asset attached, please attach " + toBase58String(A4AAssetID)) + " only.")) | |
96 | - | else if ((6 >= days)) | |
97 | - | then throw("Choose Locking days in between 7 to 90.") | |
98 | - | else if ((days > maximumlockdays)) | |
99 | - | then throw("You Entered days greater than 90 please Enter no. of days in between 7 to 90.") | |
100 | - | else if ((33300000000 > pmt.amount)) | |
101 | - | then throw("Please Attach minimum 333 A4A To Achieve BRONZE TIER.") | |
102 | - | else if ((ULBT >= pmt.amount)) | |
103 | - | then [StringEntry(("Tier_Of_" + currentKey), "BRONZE"), IntegerEntry(("Deposit_height_Of_" + currentKey), height), IntegerEntry("Staked_Amount", newStakedA4AAmount), IntegerEntry(("Deposit_Amount_Of_" + currentKey), newA4AAmount), IntegerEntry(("Total_Lock_Blocks_Of_" + currentKey), totallockblocks), StringEntry(("Lock_Status_Of_" + currentKey), lockstatus), IntegerEntry(("Rewards_Of_" + currentKey), fraction(fraction(Tier1, pmt.amount, pow(10, 0, 8, 0, 0, UP)), actualblocks, pow(10, 0, 6, 0, 0, UP)))] | |
104 | - | else if ((ULST >= pmt.amount)) | |
105 | - | then [StringEntry(("Tier_Of_" + currentKey), "SILVER"), IntegerEntry(("Deposit_height_Of_" + currentKey), height), IntegerEntry("Staked_Amount", newStakedA4AAmount), IntegerEntry(("Deposit_Amount_Of_" + currentKey), newA4AAmount), IntegerEntry(("Total_Lock_Blocks_Of_" + currentKey), totallockblocks), StringEntry(("Lock_Status_Of_" + currentKey), lockstatus), IntegerEntry(("Rewards_Of_" + currentKey), Tier1rewards)] | |
106 | - | else if ((ULGT >= pmt.amount)) | |
107 | - | then [StringEntry(("Tier_Of_" + currentKey), "GOLD"), IntegerEntry(("Deposit_height_Of_" + currentKey), height), IntegerEntry("Staked_Amount", newStakedA4AAmount), IntegerEntry(("Deposit_Amount_Of_" + currentKey), newA4AAmount), IntegerEntry(("Total_Lock_Blocks_Of_" + currentKey), totallockblocks), StringEntry(("Lock_Status_Of_" + currentKey), lockstatus), IntegerEntry(("Rewards_Of_" + currentKey), Tier2rewards)] | |
108 | - | else if ((ULDT == pmt.amount)) | |
109 | - | then [StringEntry(("Tier_Of_" + currentKey), "DIAMOND"), IntegerEntry(("Deposit_height_Of_" + currentKey), height), IntegerEntry("Staked_Amount", newStakedA4AAmount), IntegerEntry(("Deposit_Amount_Of_" + currentKey), newA4AAmount), IntegerEntry(("Total_Lock_Blocks_Of_" + currentKey), totallockblocks), StringEntry(("Lock_Status_Of_" + currentKey), lockstatus), IntegerEntry(("Rewards_Of_" + currentKey), Tier3rewards)] | |
110 | - | else throw("Please Choose a Range Between 333-12000.") | |
111 | - | } | |
112 | - | ||
113 | - | ||
114 | - | ||
115 | - | @Callable(i) | |
116 | - | func Withdraw () = { | |
117 | - | let currentKey = toBase58String(i.caller.bytes) | |
118 | - | let checkdepositvalue = getIntegerValue(this, ("Deposit_Amount_Of_" + currentKey)) | |
119 | - | let checkstakedvalue = getIntegerValue(this, "Staked_Amount") | |
120 | - | let newstakedvalue = (checkstakedvalue - checkdepositvalue) | |
121 | - | let check90Dgap = (getIntegerValue(this, ("Total_Lock_Blocks_Of_" + currentKey)) - getIntegerValue(this, ("Deposit_height_Of_" + currentKey))) | |
122 | - | let fetchRewardData = getIntegerValue(this, "Total_USDT_Claimed:") | |
123 | - | let totalrewardclaimed = (fetchRewardData + getIntegerValue(this, ("Rewards_Of_" + currentKey))) | |
124 | - | if ((getIntegerValue(this, ("Total_Lock_Blocks_Of_" + currentKey)) > height)) | |
125 | - | then throw(((("Your " + toString(getIntegerValue(this, ("Deposit_Amount_Of_" + currentKey)))) + " A4A 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)))) | |
126 | - | else if ((checkdepositvalue == 0)) | |
127 | - | then throw("You Have Already Withdraw your Amount.") | |
128 | - | else if ((check90Dgap == 129600)) | |
129 | - | then [ScriptTransfer(i.caller, getIntegerValue(this, ("Deposit_Amount_Of_" + currentKey)), A4AAssetID), ScriptTransfer(i.caller, getIntegerValue(this, ("Rewards_Of_" + currentKey)), USDTAssetID), ScriptTransfer(i.caller, ((getIntegerValue(this, ("Deposit_Amount_Of_" + currentKey)) * 3) / 1000), CODEAssetID), StringEntry(("Tier_Of_" + currentKey), "NONE"), 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_USDT_Claimed:", totalrewardclaimed)] | |
130 | - | else [ScriptTransfer(i.caller, getIntegerValue(this, ("Deposit_Amount_Of_" + currentKey)), A4AAssetID), ScriptTransfer(i.caller, getIntegerValue(this, ("Rewards_Of_" + currentKey)), USDTAssetID), StringEntry(("Tier_Of_" + currentKey), "NONE"), 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_USDT_Claimed:", totalrewardclaimed)] | |
131 | - | } | |
132 | - | ||
133 | - | ||
134 | - | ||
135 | - | @Callable(i) | |
136 | - | func DepositUSDT () = { | |
137 | - | let pmt = if ((size(i.payments) == 1)) | |
138 | - | then i.payments[0] | |
139 | - | else throw("No payment attached, Please Attach USDT Token in payment[1].") | |
140 | - | let calleraddress = toBase58String(i.caller.bytes) | |
141 | - | let USDTdepositor = getStringValue(this, "Funding_Address") | |
142 | - | let fetcholdUSDTbal = getIntegerValue(this, "USDT_Balance") | |
143 | - | let oldUSDTbal = match getInteger(this, "USDT_Balance") { | |
144 | - | case a: Int => | |
145 | - | a | |
146 | - | case _ => | |
147 | - | 0 | |
148 | - | } | |
149 | - | let newUSDTbal = (oldUSDTbal + pmt.amount) | |
150 | - | if ((USDTdepositor != calleraddress)) | |
151 | - | then throw((("I know You are not An Admin. Only " + USDTdepositor) + " has rights to add USDT Funds.")) | |
152 | - | else if ((pmt.assetId != USDTAssetID)) | |
153 | - | then throw((("Kindly Deposit Only USDT " + toBase58String(USDTAssetID)) + " AssetID.")) | |
154 | - | else if ((1000000 > pmt.amount)) | |
155 | - | then throw("Attach minimum 1 USDT atleast For Payment.") | |
156 | - | else [IntegerEntry("USDT_Balance", newUSDTbal)] | |
22 | + | let allowdedpymt = (blockdiff * 100000) | |
23 | + | let NewCODEToUser = (StartInflation * pmt.amount) | |
24 | + | let PreviousIssuedCODE = getIntegerValue(this, "Total_Issued_CODE:") | |
25 | + | let TotalIssuedCODE = (PreviousIssuedCODE + NewCODEToUser) | |
26 | + | let PreviousBurnedCODE = getIntegerValue(this, "Total_Burned_CODE:") | |
27 | + | let TotalBurnedCODE = (PreviousBurnedCODE + pmt.amount) | |
28 | + | let PreviousTxnsCODE = getIntegerValue(this, "Total_Txns:") | |
29 | + | let TotalTxnsCODE = (PreviousTxnsCODE + 1) | |
30 | + | let fetchuserstakedblanace = valueOrErrorMessage(getIntegerValue(addressFromPublicKey(base58'C246qxhuyo9DBk1pjMzEQSVAWmiqYupG2swGkxTeAvLV'), ("Deposit_Amount_Of_" + currentKey)), "Address not Found") | |
31 | + | if ((StartHeight > height)) | |
32 | + | then throw((("DApp is Not Started Yet please Wait until " + toString((StartHeight - height))) + " blocks")) | |
33 | + | else if ((pmt.assetId != CODEAssetID)) | |
34 | + | then throw(("Incorrect asset attached, please attach " + toBase58String(CODEAssetID))) | |
35 | + | else if ((100000 > pmt.amount)) | |
36 | + | then throw("Please Attach minimum 0.001 CODE To Issue CODE Asset.") | |
37 | + | else if ((pmt.amount > allowdedpymt)) | |
38 | + | then throw((("You can attach maximum " + toString(allowdedpymt)) + "/10^8 CODE.")) | |
39 | + | else [IntegerEntry("Inflation", StartInflation), IntegerEntry("Total_Issued_CODE:", TotalIssuedCODE), IntegerEntry("Total_Burned_CODE:", TotalBurnedCODE), IntegerEntry("Total_Txns:", TotalTxnsCODE), IntegerEntry(("Claim_Amount_" + currentKey), NewCODEToUser), IntegerEntry("User_Staked_Amount:", fetchuserstakedblanace), Burn(CODEAssetID, pmt.amount), ScriptTransfer(i.caller, NewCODEToUser, CODEAssetID), StringEntry("message", "<h1>CODE Issued Successfully!</h1><br>")] | |
157 | 40 | } | |
158 | 41 | ||
159 | 42 | ||
160 | 43 | @Verifier(tx) | |
161 | 44 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
162 | 45 |
github/deemru/w8io/169f3d6 57.19 ms ◑