23 | | - | func Liquidate () = { |
---|
24 | | - | let currentKey = toBase58String(i.callerPublicKey) |
---|
25 | | - | let pmt = value(i.payments[0]) |
---|
26 | | - | let PreviousIssuedA4A = getIntegerValue(this, "Total_Issued_A4A:") |
---|
27 | | - | let PreviousBurnedA4A = getIntegerValue(this, "Total_Burned_A4A:") |
---|
28 | | - | let TotalIssuedA4A = (PreviousIssuedA4A - pmt.amount) |
---|
29 | | - | let TotalBurnedA4A = (PreviousBurnedA4A + pmt.amount) |
---|
30 | | - | let PreviousA4AReserveValue = getIntegerValue(this, "Total_A4A_Reserve_In_TN:") |
---|
31 | | - | let PreviousA4ABackupPrice = getIntegerValue(this, "A4A_Backup_Value_In_TN:") |
---|
32 | | - | let calculateburnvalue = fraction(PreviousA4ABackupPrice, pmt.amount, 100000) |
---|
33 | | - | let A4AReserveValue = (PreviousA4AReserveValue - calculateburnvalue) |
---|
34 | | - | let A4ABackupPrice = fraction(100000, A4AReserveValue, TotalIssuedA4A) |
---|
35 | | - | if ((pmt.assetId != A4AAssetID)) |
---|
36 | | - | then throw("Kindly Deposit Only 8hdsVCxPBVEmVUZyyX8Sd98Z9hU7Fny26W96sjKiTw8g (A4A).") |
---|
37 | | - | else if ((100000 > pmt.amount)) |
---|
38 | | - | then throw("Attach Amount must be greater than 0.001 A4A.") |
---|
39 | | - | 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)] |
---|
| 7 | + | func Issue_SWRM () = { |
---|
| 8 | + | let asset = Issue("SWRM", "SWRM is a decentralized approach to building and utilizing the Reddcoin Blockchain Technology where SWRM works on a reserve system of RDD as layer solution on RDD Network to mint and Burn SWRM on both side as a proof. An independent project or Token having no direct partnership relation or development connection with Reddcoin Core Team outside the use of the RDD currency for transactions.", 1, 6, true) |
---|
| 9 | + | let assetId = calculateAssetId(asset) |
---|
| 10 | + | if ((i.caller != Treasury)) |
---|
| 11 | + | then throw((("This Address is not Authorized. Only " + toString(Treasury)) + " is Authorized Address to Sign it.")) |
---|
| 12 | + | else [asset, Burn(assetId, 1), StringEntry("SWRM_Asset_ID", toBase58String(assetId))] |
---|
43 | | - | |
---|
44 | | - | @Callable(i) |
---|
45 | | - | func Withdraw () = { |
---|
46 | | - | let currentKey = toBase58String(i.caller.bytes) |
---|
47 | | - | let checkdepositvalue = getIntegerValue(this, ("Deposit_Amount_Of_" + currentKey)) |
---|
48 | | - | let checkstakedvalue = getIntegerValue(this, "Staked_Amount") |
---|
49 | | - | let d6 = 1000000 |
---|
50 | | - | let user_share = fraction(checkdepositvalue, d6, checkstakedvalue) |
---|
51 | | - | let newstakedvalue = (checkstakedvalue - checkdepositvalue) |
---|
52 | | - | let check90Dgap = (getIntegerValue(this, ("Total_Lock_Blocks_Of_" + currentKey)) - getIntegerValue(this, ("Deposit_height_Of_" + currentKey))) |
---|
53 | | - | let Previous_USDC_Claimed = match getInteger(this, "Total_USDC_Claimed:") { |
---|
54 | | - | case a: Int => |
---|
55 | | - | a |
---|
56 | | - | case _ => |
---|
57 | | - | 0 |
---|
58 | | - | } |
---|
59 | | - | let totalrewardclaimed = (Previous_USDC_Claimed + getIntegerValue(this, ("Rewards_Of_" + currentKey))) |
---|
60 | | - | if ((getIntegerValue(this, ("Total_Lock_Blocks_Of_" + currentKey)) > height)) |
---|
61 | | - | 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))) + " blocks.")) |
---|
62 | | - | else if ((checkdepositvalue == 0)) |
---|
63 | | - | then throw("You Have Already Withdraw your Amount.") |
---|
64 | | - | else if (if ((1200000000000 > checkdepositvalue)) |
---|
65 | | - | then (check90Dgap == 129600) |
---|
66 | | - | else false) |
---|
67 | | - | then [ScriptTransfer(i.caller, getIntegerValue(this, ("Deposit_Amount_Of_" + currentKey)), A4AAssetID), ScriptTransfer(i.caller, fraction(assetBalance(this, USDCAssetID), user_share, d6), USDCAssetID), ScriptTransfer(i.caller, fraction(assetBalance(this, WAVESAssetID), user_share, d6), WAVESAssetID), ScriptTransfer(i.caller, ((checkdepositvalue * 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_USDC_Claimed:", totalrewardclaimed)] |
---|
68 | | - | else if (if ((checkdepositvalue >= 1200000000000)) |
---|
69 | | - | then (check90Dgap == 129600) |
---|
70 | | - | else false) |
---|
71 | | - | then [ScriptTransfer(i.caller, getIntegerValue(this, ("Deposit_Amount_Of_" + currentKey)), A4AAssetID), ScriptTransfer(i.caller, fraction(assetBalance(this, USDCAssetID), user_share, d6), USDCAssetID), ScriptTransfer(i.caller, fraction(assetBalance(this, WAVESAssetID), user_share, d6), WAVESAssetID), ScriptTransfer(i.caller, ((1200000000000 * 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_USDC_Claimed:", totalrewardclaimed)] |
---|
72 | | - | else [ScriptTransfer(i.caller, getIntegerValue(this, ("Deposit_Amount_Of_" + currentKey)), A4AAssetID), ScriptTransfer(i.caller, fraction(assetBalance(this, USDCAssetID), user_share, d6), USDCAssetID), ScriptTransfer(i.caller, fraction(assetBalance(this, WAVESAssetID), user_share, d6), WAVESAssetID), 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_USDC_Claimed:", totalrewardclaimed)] |
---|
73 | | - | } |
---|
74 | | - | |
---|
| 16 | + | @Verifier(tx) |
---|
| 17 | + | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) |
---|