Documentation ¶
Index ¶
- Constants
- func HexToAddress(s string) []byte
- func Initialise(ctx context.Context, log *zap.SugaredLogger, cfg *config.Config, ...)
- func SubscribeAllWallets(ctx context.Context, harv *Harvester, cfg *config.Config, pool *pgxpool.Pool) error
- type Adapter
- type AdapterListener
- type Address
- type BCBlock
- type BCDiff
- type BCStake
- type BCType
- type Callback
- type Callbacks
- type Event
- type Harvester
- func (h *Harvester) Init()
- func (h *Harvester) OnBalanceChange()
- func (h *Harvester) OnNewBlock(bcType string, block *BCBlock)
- func (h *Harvester) RegisterAdapter(adapter Adapter) error
- func (h *Harvester) Run() error
- func (h *Harvester) Subscribe(bcType string, eventName Event, callback Callback)
- func (h *Harvester) SubscribeForWallet(bcType string, wallet, callback Callback)
- func (h *Harvester) SubscribeForWalletAndContract(bcType string, wallet string, contract string, callback Callback) error
- func (h *Harvester) Unsubscribe(bcType string, eventName Event, callback Callback)
- type IHarvester
- type NftEvent
- type RestakeLog
- type StakeEvent
- type StakeLog
- type Table
- type Table2
- func (t *Table2) AddWalletContract(wallet string, contract string)
- func (t *Table2) Display()
- func (t *Table2) GetLastCommentByTxHash(txHash string) (string, error)
- func (t *Table2) LoadFromDB() error
- func (t *Table2) ProcessLogs(blockNumber uint64, logs []any)
- func (t *Table2) Run()
- func (t *Table2) SaveToDB(events []*UpdateEvent, stakeEvents []*StakeEvent, nftLogs []*TransferNFTLog) (err error)
- type TransferERC20Log
- type TransferNFTLog
- type UnstakeLog
- type UpdateEvent
Constants ¶
View Source
const ArbitrumNova string = "arbitrum_nova"
View Source
const Ethereum string = "ethereum"
View Source
const Polkadot string = "polkadot"
Variables ¶
This section is empty.
Functions ¶
func HexToAddress ¶
func Initialise ¶
Types ¶
type Adapter ¶
type Adapter interface { GetLastBlockNumber() (uint64, error) GetBalance(wallet string, contract string, blockNumber uint64) (*big.Int, error) GetLogs(fromBlock, toBlock int64, addresses []common.Address) ([]any, error) GetLogsRecursively(fromBlock, toBlock int64, addresses []common.Address, level int) ([]any, error) RegisterNewBlockListener(f AdapterListener) Run() GetInfo() (umid umid.UMID, name string, rpcURL string) }
type AdapterListener ¶
type Callbacks ¶
func NewCallbacks ¶
func NewCallbacks() *Callbacks
type Event ¶
type Event string
const BalanceChange Event = "balance_change"
const NewBlock Event = "new_block"
type Harvester ¶
type Harvester struct {
// contains filtered or unexported fields
}
func GetInstance ¶
func GetInstance() *Harvester
func NewHarvester ¶
func (*Harvester) OnBalanceChange ¶
func (h *Harvester) OnBalanceChange()
func (*Harvester) OnNewBlock ¶
func (*Harvester) RegisterAdapter ¶
func (*Harvester) SubscribeForWallet ¶
func (*Harvester) SubscribeForWalletAndContract ¶
type IHarvester ¶
type IHarvester interface { RegisterAdapter(bcAdapter Adapter) error OnBalanceChange() Subscribe(bcType string, eventName Event, callback Callback) Unsubscribe(bcType string, eventName Event, callback Callback) SubscribeForWallet(bcType string, wallet, callback Callback) SubscribeForWalletAndContract(bcType string, wallet string, contract string, callback Callback) error }
type RestakeLog ¶
type RestakeLog struct { UserWallet string FromOdysseyID umid.UMID ToOdysseyID umid.UMID Amount *big.Int TokenType uint8 TotalStakedToFrom *big.Int TotalStakedToTo *big.Int }
*
* * @param user User address * @param odyssey_from Odyssey ID that the user is removing stake * @param odyssey_to Odyssey ID that the user is staking into * @param amount Amount that's being restaked * @param token Token used (MOM or DAD) * @param total_staked_from Total amount of tokens that remains staked on the `odyssey_from` * @param total_staked_to Total amount of tokens staked on `odyssey_to`
event Restake(address user, bytes16 odyssey_from, bytes16 odyssey_to, uint256 amount, Token token, uint256 total_staked_from, uint256 total_staked_to);
type StakeEvent ¶
type StakeLog ¶
type StakeLog struct { LogIndex uint TxHash string UserWallet string OdysseyID umid.UMID AmountStaked *big.Int TokenType uint8 TotalStaked *big.Int }
*
* * @param user User address * @param odyssey Odyssey ID that's being staked * @param amount_staked Amount being staked * @param token Token used (MOM or DAD) * @param total_staked Total being staked by the user on the Odyssey
event Stake(address user, bytes16 odyssey, uint256 amount_staked, Token token, uint256 total_staked);
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
func NewTable ¶
func NewTable(db *pgxpool.Pool, adapter Adapter, listener func(bcName string, p []*UpdateEvent, s []*StakeEvent)) *Table
func (*Table) AddWalletContract ¶
func (*Table) LoadFromDB ¶
func (*Table) ProcessDiffs ¶
func (*Table) SaveToDB ¶
func (t *Table) SaveToDB(events []*UpdateEvent, stakeEvents []*StakeEvent) (err error)
type Table2 ¶
type Table2 struct {
// contains filtered or unexported fields
}
func NewTable2 ¶
func NewTable2(db *pgxpool.Pool, adapter Adapter, listener func(bcName string, p []*UpdateEvent, s []*StakeEvent, n []*NftEvent) error) *Table2
func (*Table2) AddWalletContract ¶
func (*Table2) GetLastCommentByTxHash ¶
func (*Table2) LoadFromDB ¶
func (*Table2) ProcessLogs ¶
func (*Table2) SaveToDB ¶
func (t *Table2) SaveToDB(events []*UpdateEvent, stakeEvents []*StakeEvent, nftLogs []*TransferNFTLog) (err error)
type TransferERC20Log ¶
type TransferNFTLog ¶
*
- @dev Emitted when `tokenId` token is transferred from `from` to `to`.
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
type UnstakeLog ¶
type UnstakeLog struct { LogIndex uint TxHash string UserWallet string OdysseyID umid.UMID AmountUnstaked *big.Int TokenType uint8 TotalStaked *big.Int }
*
* * @param user User address * @param odyssey Odyssey ID that's being unstaked * @param amount_unstaked Amount unstaked * @param token Token used (MOM or DAD) * @param total_staked Total remained staked by the user on that Odyssey
event Unstake(address user, bytes16 odyssey, uint256 amount_unstaked, Token token, uint256 total_staked);
Source Files ¶
Click to show internal directories.
Click to hide internal directories.