-
Notifications
You must be signed in to change notification settings - Fork 0
/
burn.cpp
111 lines (91 loc) · 4.47 KB
/
burn.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#include <burn.hpp>
/*
A simple contract, to which users send DOP, HUB or DMD, and then the contract burns the coins.
*/
[[eosio::on_notify("dop.efi::transfer")]]
void burncontrak::burndop(const name& owner_account, const name& to, const asset& burn_quantity_dop, std::string memo)
{
if (to != get_self() || owner_account == get_self())
{
print("*these are not the droids you are looking for*");
return;
}
check(owner_account == "funds.efi"_n, "error: the burning is not yet open to the public.");
check(burn_quantity_dop.amount >= 100000, "error: must burn a minimum of 10 DOP");
check(burn_quantity_dop.symbol == dop_symbol, "error: these are not the droids you are looking for.");
std::string custom_memo;
if (burn_quantity_dop.amount <= 1000000)
custom_memo = "A pitiful sacrifice!";
else if ((burn_quantity_dop.amount >= 1000000) && (burn_quantity_dop.amount < 10000000))
custom_memo = "A worthy sacrifice to the Market Gods!";
else if ((burn_quantity_dop.amount >= 10000000) && (burn_quantity_dop.amount < 100000000))
custom_memo = "An incredible sacrifice to the Market Gods!";
else if ((burn_quantity_dop.amount >= 100000000) && (burn_quantity_dop.amount < 1000000000))
custom_memo = "A godlike sacrifice to the Market Gods.";
else
custom_memo = "Wesa goen tada moon, sers!";
burncontrak::inline_burndop(get_self(), burn_quantity_dop, custom_memo);
}
[[eosio::on_notify("hub.efi::transfer")]]
void burncontrak::burnhub(const name& owner_account, const name& to, const asset& burn_quantity_hub, std::string memo)
{
if (to != get_self() || owner_account == get_self())
{
print("*these are not the droids you are looking for*");
return;
}
check(owner_account == "funds.efi"_n, "error: the burning is not yet open to the public.");
check(burn_quantity_hub.amount >= 100000, "error: must burn a minimum of 10 HUB");
check(burn_quantity_hub.symbol == hub_symbol, "error: these are not the droids you are looking for.");
std::string custom_memo;
if (burn_quantity_hub.amount <= 1000000)
custom_memo = "A pitiful sacrifice!";
else if ((burn_quantity_hub.amount >= 1000000) && (burn_quantity_hub.amount < 10000000))
custom_memo = "A worthy sacrifice to the Market Gods!";
else if ((burn_quantity_hub.amount >= 10000000) && (burn_quantity_hub.amount < 100000000))
custom_memo = "An incredible sacrifice to the Market Gods!";
else if ((burn_quantity_hub.amount >= 100000000) && (burn_quantity_hub.amount < 1000000000))
custom_memo = "A godlike sacrifice to the Market Gods.";
else
custom_memo = "Wesa goen tada moon, sers!";
burncontrak::inline_burnhub(get_self(), burn_quantity_hub, custom_memo);
}
[[eosio::on_notify("dmd.efi::transfer")]]
void burncontrak::burndmd(const name& owner_account, const name& to, const asset& burn_quantity_dmd, std::string memo)
{
if (to != get_self() || owner_account == get_self())
{
print("*these are not the droids you are looking for*");
return;
}
check(owner_account == "funds.efi"_n, "error: the burning is not yet open to the public.");
check(burn_quantity_dmd.amount >= 100000, "error: must burn a minimum of 10 DMD");
check(burn_quantity_dmd.symbol == dmd_symbol, "error: these are not the droids you are looking for.");
std::string custom_memo;
if (burn_quantity_dmd.amount <= 1000000)
custom_memo = "A pitiful sacrifice!";
else if ((burn_quantity_dmd.amount >= 1000000) && (burn_quantity_dmd.amount < 10000000))
custom_memo = "A worthy sacrifice to the Market Gods!";
else if ((burn_quantity_dmd.amount >= 10000000) && (burn_quantity_dmd.amount < 100000000))
custom_memo = "An incredible sacrifice to the Market Gods!";
else if ((burn_quantity_dmd.amount >= 100000000) && (burn_quantity_dmd.amount < 1000000000))
custom_memo = "A godlike sacrifice to the Market Gods.";
else
custom_memo = "Wesa goen tada moon, sers!";
burncontrak::inline_burndmd(get_self(), burn_quantity_dmd, custom_memo);
}
void burncontrak::set(uint32_t player_limit)
{
require_auth(get_self());
totaltable burnerdata(get_self(), "totals"_n.value);
auto total_it = burnerdata.find("totals"_n.value);
if(total_it != burnerdata.end())
{
burnerdata.modify(total_it, get_self(), [&]( auto& row)
{
row.player_limit = player_limit;
});
}
else
return;
}