-
Notifications
You must be signed in to change notification settings - Fork 40
/
types.hpp
89 lines (79 loc) · 1.92 KB
/
types.hpp
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
#include "utils.hpp"
#include <eosiolib/singleton.hpp>
#define EOS_SYMBOL S(4, EOS)
#define DICE_SYMBOL S(4, BOCAI)
#define LOG N(eosbocailogs)
#define DICETOKEN N(eosbocai1111)
#define DEV N(eosbocaidevv)
#define PRIZEPOOL N(eosbocai1111)
#define DICESUPPLY 88000000000000
#define FOMOTIME 24 * 60 * 60
typedef uint32_t eostime;
using eosio::extended_asset;
using eosio::singleton;
// @abi table bets i64
struct st_bet
{
uint64_t id;
account_name player;
account_name referrer;
extended_asset amount;
uint8_t roll_under;
uint64_t created_at;
uint64_t primary_key() const { return id; }
};
// @abi table tokens i64
struct st_tokens
{
account_name contract; // 合约账号
symbol_type symbol; // 代币名称
uint64_t minAmout; //最小允许投注的值
uint64_t primary_key() const { return contract + symbol; }
};
typedef multi_index<N(tokens), st_tokens> tb_tokens;
// @abi table users1 i64
struct st_user1
{
asset amount = asset(0, EOS_SYMBOL);
uint32_t count = 0;
};
// @abi table users i64
struct st_user
{
account_name owner;
asset amount;
uint32_t count;
uint64_t primary_key() const { return owner; }
};
typedef singleton<N(users1), st_user1> tb_uesrs1;
struct st_result
{
uint64_t bet_id;
account_name player;
account_name referrer;
asset amount;
uint8_t roll_under;
uint8_t random_roll;
asset payout;
};
// @abi table fundpool i64
struct st_fund_pool
{
asset locked;
};
// @abi table global i64
struct st_global
{
uint64_t current_id;
double eosperdice;
uint64_t nexthalve;
uint64_t initStatu;
account_name lastPlayer;
eostime endtime;
asset fomopool;
};
// typedef multi_index<N(users), st_user> tb_uesrs;
typedef multi_index<N(bets), st_bet> tb_bets;
typedef multi_index<N(users), st_user> tb_uesrs;
typedef singleton<N(fundpool), st_fund_pool> tb_fund_pool;
typedef singleton<N(global), st_global> tb_global;