Documentation ¶
Index ¶
- Constants
- Variables
- func CheckIfPresent(pubkey string, arr *[]TPubKey) bool
- func GetBeaconBestStateDetail(reqUrl string, bbsd *BBSD) error
- func GetBlockChainInfo(reqUrl string, bci *BCI) error
- func GetMinerRewardFromMiningKey(reqUrl string, key string, mrmfk *MRFMK) error
- func GetTSString(ts int64) string
- func GetTSTime(ts int64) time.Time
- func GetTsMonthLimitsFromTm(tm time.Time) (int64, int64)
- func GetTsMonthLimitsFromTs(timestamp int64) (int64, int64)
- func MakeTSFromString(t string) (int64, error)
- func MakeTSFromTime(t time.Time) int64
- type BBSD
- type BCI
- type COIN
- type COINS
- type ChatKey
- type ChatUser
- type Cmd
- type DBnode
- func (db *DBnode) AddLotteryTickets(ts int64, pubkey string) ([]LotteryKey, error)
- func (db *DBnode) ChangeNotify(ChatID int64) bool
- func (db *DBnode) CreateTablesIfNotExists() error
- func (db *DBnode) CreateUserByChatID(chatID int64) (*ChatUser, error)
- func (db *DBnode) DelChatKey(chatID int64, keyAlias string) error
- func (db *DBnode) DelNode(unid int64) error
- func (db *DBnode) GetChatKey(chatID int64, keyAlias string) (*ChatKey, error)
- func (db *DBnode) GetChatKeyFromPub(chatID int64, pubkey string) (*ChatKey, error)
- func (db *DBnode) GetChatKeys(chatID int64, limit, offset int) (*[]ChatKey, error)
- func (db *DBnode) GetChatKeysByPubKey(pubkey string, limit, offset int) (*[]ChatKey, error)
- func (db *DBnode) GetFionaText() string
- func (db *DBnode) GetLotteries() ([]Lottery, error)
- func (db *DBnode) GetLotteryByKey(loid int64) Lottery
- func (db *DBnode) GetLotteryChatIDS(loid int64) ([]LotteryChat, error)
- func (db *DBnode) GetLotteryExtract(loid int64, tm time.Time) (int, error)
- func (db *DBnode) GetLotteryExtraction(loid, timestamp int64) (LotteryExtraction, error)
- func (db *DBnode) GetLotteryIDS(chatid int64) ([]LotteryChat, error)
- func (db *DBnode) GetLotteryKeyByKey(loid int64, pubkey string) LotteryKey
- func (db *DBnode) GetLotteryKeysByPuKey(pubkey string) ([]LotteryKey, error)
- func (db *DBnode) GetLotteryTickets(loid int64, tm time.Time, extract int64) ([]LotteryTicket, error)
- func (db *DBnode) GetMiningKey(pubkey string) (*MiningKey, error)
- func (db *DBnode) GetMiningKeys(limit, offset int) (*[]MiningKey, error)
- func (db *DBnode) GetNotify(ChatID int64) bool
- func (db *DBnode) GetRingraziamentoText() string
- func (db *DBnode) GetUrlNode(chatID int64, NodeName string) (*UrlNode, error)
- func (db *DBnode) GetUrlNodes(chatID int64, limit, offset int) (*[]UrlNode, error)
- func (db *DBnode) GetUserByChatID(chatID int64) (*ChatUser, error)
- func (db *DBnode) GetUsersList(limit, offset int) (*[]ChatUser, error)
- func (db *DBnode) NotifyAllLotteryUsersTicket(ts int64, lotterykeys []LotteryKey, callback LotteryUserTicketNotifierFunc) error
- func (db *DBnode) ReplaceLotteryExtraction(lotteryextraction LotteryExtraction) error
- func (db *DBnode) UpdateChatKey(chatKey *ChatKey) error
- func (db *DBnode) UpdateLotteryTicketWinner(ticket LotteryTicket) error
- func (db *DBnode) UpdateMiningKey(miningkey *MiningKey, callback StatusChangeNotifierFunc) error
- func (db *DBnode) UpdateUrlNode(urlnode *UrlNode) error
- func (db *DBnode) UpdateUser(user *ChatUser) error
- type Env
- func (env *Env) GetSendMessageUrl() string
- func (env *Env) NotifyTicket(loid, ts int64, chatuser *ChatUser, chatkey *ChatKey) error
- func (env *Env) PrintBOT_CMDS() string
- func (env *Env) RemoveCmd(text string) string
- func (env *Env) SayErr(chatID int64, err error) error
- func (env *Env) SayText(chatID int64, text string) error
- func (env *Env) StatusChanged(miningkey *MiningKey, oldstat string, oldprv int64) error
- func (env *Env) StrCmd(text string) string
- type Lottery
- type LotteryChat
- type LotteryExtraction
- type LotteryKey
- type LotteryTicket
- type LotteryUserTicketNotifierFunc
- type MRFMK
- type MiningKey
- type StatusChangeNotifierFunc
- type TBeaconStateResult
- type TBestBlock
- type TBlochChainInfo
- type TMinerReward
- type TMiningPubKey
- type TPubKey
- type TPubKeyAuto
- type TPubKeyInfo
- type UrlNode
Constants ¶
const PRV_ID = "0000000000000000000000000000000000000000000000000000000000000004"
const TimeStampFormat = "2006-01-02 15:04:05 MST"
Variables ¶
var BIG_COINS = COINS{ COIN{Name: "PRV", ID: PRV_ID, Dec: 1e-09}, COIN{Name: "ETH", ID: "ffd8d42dc40a8d166ea4848baf8b5f6e912ad79875f4373070b59392b1756c8f", Dec: 1e-09}, COIN{Name: "XMR", ID: "c01e7dc1d1aba995c19b257412340b057f8ad1482ccb6a9bb0adce61afbf05d4", Dec: 1e-09}, COIN{Name: "USDT", ID: "716fd1009e2a1669caacc36891e707bfdf02590f96ebd897548e8963c95ebac0", Dec: 1e-06}, COIN{Name: "USDC", ID: "1ff2da446abfebea3ba30385e2ca99b0f0bbeda5c6371f4c23c939672b429a42", Dec: 1e-06}, COIN{Name: "BTC", ID: "b832e5d3b1f01a4f0623f7fe91d6673461e1f5d37d91fe78c5c2e6183ff39696", Dec: 1e-09}, COIN{Name: "BUSD", ID: "9e1142557e63fd20dee7f3c9524ffe0aa41198c494aa8d36447d12e85f0ddce7", Dec: 1e-06}, COIN{Name: "BNB", ID: "b2655152784e8639fa19521a7035f331eea1f1e911b2f3200a507ebb4554387b", Dec: 1e-09}, COIN{Name: "DAI", ID: "3f89c75324b46f13c7b036871060e641d996a24c09b3065835cb1d38b799d6c1", Dec: 1e-09}, COIN{Name: "SAI", ID: "d240c61c6066fed0535df9302f1be9f5c9728ef6d01ce88d525c4f6ff9d65a56", Dec: 1e-06}, COIN{Name: "TUSD", ID: "8c3a61e77061265aaefa1e7160abfe343c2189278dd224bb7da6e7edc6a1d4db", Dec: 1e-06}, COIN{Name: "TOMO", ID: "a0a22d131bbfdc892938542f0dbe1a7f2f48e16bc46bf1c5404319335dc1f0df", Dec: 1e-06}, COIN{Name: "LINK", ID: "e0926da2436adc42e65ca174e590c7b17040cd0b7bdf35982f0dd7fc067f6bcf", Dec: 1e-06}, COIN{Name: "BAT", ID: "1fe75e9afa01b85126370a1583c7af9f1a5731625ef076ece396fcc6584c2b44", Dec: 1e-06}, COIN{Name: "BAND", ID: "2dda855fb4660225882d11136a64ad80effbddfa18a168f78924629b8664a6b3", Dec: 1e-06}, COIN{Name: "ZRX", ID: "de395b1914718702687b477703bdd36e52119033a9037bb28f6b33a3d0c2f867", Dec: 1e-06}, COIN{Name: "FTM", ID: "d09ad0af0a34ea3e13b772ef9918b71793a18c79b2b75aec42c53b69537029fe", Dec: 1e-06}, COIN{Name: "ZIL", ID: "880ea0787f6c1555e59e3958a595086b7802fc7a38276bcd80d4525606557fbc", Dec: 1e-06}, COIN{Name: "MCO", ID: "caaf286e889a8e0cee122f434d3770385a0fd92d27fcee737405b73c45b4f05f", Dec: 1e-06}, COIN{Name: "GUSD", ID: "465b0f709844be95d97e1f5c484e79c6c1ac51d28de2a68020e7313d34f644fe", Dec: 1e-06}, COIN{Name: "PAX", ID: "4a790f603aa2e7afe8b354e63758bb187a4724293d6057a46859c81b7bd0e9fb", Dec: 1e-06}, COIN{Name: "KCS", ID: "513467653e06af73cd2b2874dd4af948f11f1c6f2689e994c055fd6934349e05", Dec: 1e-06}, COIN{Name: "OMG", ID: "249ca174b4dce58ea6e1f8eda6e6f74ab6a3de4e4913c4f50c15101001bb467b", Dec: 1e-06}, }
Functions ¶
func CheckIfPresent ¶
func GetBlockChainInfo ¶
func GetTSString ¶
func GetTsMonthLimitsFromTm ¶
Returns the timestamps from begin of month to begin of next month of the Time passed
func GetTsMonthLimitsFromTs ¶
Returns the timestamps from begin of month to begin of next month of the TimeStamp passed
func MakeTSFromString ¶
func MakeTSFromTime ¶
Types ¶
type DBnode ¶
func (*DBnode) AddLotteryTickets ¶
func (db *DBnode) AddLotteryTickets(ts int64, pubkey string) ([]LotteryKey, error)
add Lottery tickets for the pubkey on every lottery this pubkey belongs with current timestamp and returns slice of LotteryKeys (or err) parameters: ts the TimeStamp, pubkey involved
func (*DBnode) ChangeNotify ¶
Cambia Notify per ChatID (ritorna il Notify impostato oppure false se non riesce)
func (*DBnode) CreateTablesIfNotExists ¶
func (*DBnode) CreateUserByChatID ¶
Crea un utente vuoto
func (*DBnode) DelChatKey ¶
Elimina ChatKey con chiave `ChatID`+`KeyAlias`
func (*DBnode) GetChatKey ¶
Recupera una Chiave della Chat dati ChatID e KeyAlias
func (*DBnode) GetChatKeyFromPub ¶
Recupera una Chiave della Chat dati ChatID e PubKey
func (*DBnode) GetChatKeys ¶
Recupera lista chiavi per ChatID
func (*DBnode) GetChatKeysByPubKey ¶
Recupera lista chiavi Chat per PubKey
func (*DBnode) GetFionaText ¶
func (*DBnode) GetLotteries ¶
returns the slice of all Lotteries (or err)
func (*DBnode) GetLotteryByKey ¶
returns Lottery by the given loid
func (*DBnode) GetLotteryChatIDS ¶
func (db *DBnode) GetLotteryChatIDS(loid int64) ([]LotteryChat, error)
returns the slice of LotteryChat (or err) for the given LotteryID (LOId)
func (*DBnode) GetLotteryExtract ¶
Returns the number of next extraction to do from a set of tickets given LOId and timestamp of the requested month returns err if problems
func (*DBnode) GetLotteryExtraction ¶
func (db *DBnode) GetLotteryExtraction(loid, timestamp int64) (LotteryExtraction, error)
return the lottery extraction given LOId and Timestamp or error
func (*DBnode) GetLotteryIDS ¶
func (db *DBnode) GetLotteryIDS(chatid int64) ([]LotteryChat, error)
returns the slice of LotteryChat (or err) for the given ChatID
func (*DBnode) GetLotteryKeyByKey ¶
func (db *DBnode) GetLotteryKeyByKey(loid int64, pubkey string) LotteryKey
returns LotteryKey by the given loid,pubkey
func (*DBnode) GetLotteryKeysByPuKey ¶
func (db *DBnode) GetLotteryKeysByPuKey(pubkey string) ([]LotteryKey, error)
returns the slice of LotteryKey (or err) for the given pubkey
func (*DBnode) GetLotteryTickets ¶
func (db *DBnode) GetLotteryTickets(loid int64, tm time.Time, extract int64) ([]LotteryTicket, error)
list Lottery tickets by month of timestamp for a LOId with extract passed if extract=-1 returns all and returns slice of LotteryTickets (or err)
func (*DBnode) GetMiningKey ¶
Recupera una MiningKey
func (*DBnode) GetMiningKeys ¶
Recupera lista chiavi mining
func (*DBnode) GetRingraziamentoText ¶
func (*DBnode) GetUrlNode ¶
Recupera un Nodo della Chat
func (*DBnode) GetUrlNodes ¶
Recupera lista nodi per ChatID
func (*DBnode) GetUserByChatID ¶
Recupera un record utente o lo crea vuoto se non esiste
func (*DBnode) GetUsersList ¶
Recupera lista utenti
func (*DBnode) NotifyAllLotteryUsersTicket ¶
func (db *DBnode) NotifyAllLotteryUsersTicket(ts int64, lotterykeys []LotteryKey, callback LotteryUserTicketNotifierFunc) error
Calls the LotteryUserTicketNotifierFunc for all the ChatUsers that knows that ChatKey
func (*DBnode) ReplaceLotteryExtraction ¶
func (db *DBnode) ReplaceLotteryExtraction(lotteryextraction LotteryExtraction) error
Deletes the lottery extraction of the same month if exists and save the one passed returns error if problems
func (*DBnode) UpdateChatKey ¶
Aggiorna/crea ChatKey con chiave `ChatID`+`KeyAlias`
func (*DBnode) UpdateLotteryTicketWinner ¶
func (db *DBnode) UpdateLotteryTicketWinner(ticket LotteryTicket) error
save the field Extracted of the ticket if there isn't another for the same lottery. Returns err if problems
func (*DBnode) UpdateMiningKey ¶
func (db *DBnode) UpdateMiningKey(miningkey *MiningKey, callback StatusChangeNotifierFunc) error
Aggiorna/crea MiningKey con chiave `PubKey`
func (*DBnode) UpdateUrlNode ¶
Aggiorna/crea UrlNode con chiave `ChatID`+`NodeName`
type Env ¶
type Env struct { DBFILE string Db *DBnode TOKEN string TGTOKEN string API string BOT_NAME string BOT_CMDS []Cmd DEFAULT_NODE_URL string DEFAULT_FULLNODE_URL string }
func (*Env) GetSendMessageUrl ¶
func (*Env) NotifyTicket ¶
func (*Env) PrintBOT_CMDS ¶
func (*Env) StatusChanged ¶
type LotteryChat ¶
type LotteryExtraction ¶
type LotteryKey ¶
type LotteryTicket ¶
type TBeaconStateResult ¶
type TBeaconStateResult struct { BestBlockHash string PreviousBestBlockHash string BestShardHash map[string]string BestShardHeight map[string]int Epoch int BeaconHeight int BeaconProposerIndex int BeaconCommittee []TPubKey BeaconPendingValidator []TPubKey CandidateShardWaitingForCurrentRandom []TPubKey CandidateBeaconWaitingForCurrentRandom []TPubKey CandidateShardWaitingForNextRandom []TPubKey CandidateBeaconWaitingForNextRandom []TPubKey RewardReceiver interface{} ShardCommittee map[string][]TPubKey ShardPendingValidator map[string][]TPubKey AutoStaking []TPubKeyAuto CurrentRandomNumber int CurrentRandomTimeStamp int IsGetRandomNumber bool MaxBeaconCommitteeSize int MinBeaconCommitteeSize int MaxShardCommitteeSize int MinShardCommitteeSize int ActiveShards int LastCrossShardState interface{} ShardHandle interface{} }
type TBestBlock ¶
type TBlochChainInfo ¶
type TBlochChainInfo struct { ChainName string BestBlocks map[string]TBestBlock ActiveShards int }
type TMinerReward ¶
func (*TMinerReward) GetNameValuePair ¶
func (mr *TMinerReward) GetNameValuePair(nameid string) (string, int64)
func (*TMinerReward) GetPRV ¶
func (mr *TMinerReward) GetPRV() int64
func (*TMinerReward) GetValueIDs ¶
func (mr *TMinerReward) GetValueIDs() []string
func (*TMinerReward) GetValueNames ¶
func (mr *TMinerReward) GetValueNames() []string
type TMiningPubKey ¶
type TPubKey ¶
type TPubKey struct { IncPubKey string MiningPubKey TMiningPubKey }
type TPubKeyAuto ¶
type TPubKeyAuto struct { IncPubKey string MiningPubKey TMiningPubKey IsAutoStake bool }
func CheckAutoStake ¶
func CheckAutoStake(pubkey string, arr *[]TPubKeyAuto) (bool, *TPubKeyAuto)
ritorna vero se trovato in AutoStake=true più la completa TPubKeyAuto
type TPubKeyInfo ¶
type TPubKeyInfo struct { IncPubKey string MiningPubKey TMiningPubKey IsAutoStake bool PRV int64 }
func GetPubKeyStatus ¶
func GetPubKeyStatus(bbsd *BBSD, pubkey string) (string, *TPubKeyInfo)
ritorna status più puntatore a TPubKeyInfo se trovata attiva