Documentation ¶
Index ¶
- Variables
- func DbConnect() (*sqlx.DB, error)
- type Account
- type AccountStore
- func (s *AccountStore) All() ([]*Account, error)
- func (s *AccountStore) CreateAccount(address string) (*Account, error)
- func (s *AccountStore) FindByAddress(address string) (*Account, error)
- func (s *AccountStore) FindById(id int) (*Account, error)
- func (s *AccountStore) FindOrCreateByAddress(address string) (*Account, error)
- type AllEvent
- type AnyEvent
- type BorrowEvent
- type Chain
- type ChainStore
- type DepositEvent
- type Event
- type EventDefn
- type EventStore
- func (s *EventStore) AllByAccount(accountId int) ([]AllEvent, error)
- func (s *EventStore) StoreBorrowEvent(protocolInstanceId int, eventDefinitionId int, txHash string, ...) (int, error)
- func (s *EventStore) StoreDepositEvent(protocolInstanceId int, eventDefinitionId int, txHash string, ...) (int, error)
- func (s *EventStore) StoreLiquidationEvent(protocolInstanceId int, eventDefinitionId int, txHash string, ...) (int, error)
- func (s *EventStore) StoreRepayEvent(protocolInstanceId int, eventDefinitionId int, txHash string, ...) (int, error)
- type EventType
- type LiquidationEvent
- type NewChain
- type NewEventDefn
- type NewProtocol
- type NewProtocolInstance
- type NewScan
- type Protocol
- type ProtocolInstance
- type ProtocolInstanceStore
- func (s *ProtocolInstanceStore) All() ([]*ProtocolInstance, error)
- func (s *ProtocolInstanceStore) CreateProtocolInstance(input NewProtocolInstance) (*ProtocolInstance, error)
- func (s *ProtocolInstanceStore) DeleteByProtocolAndChain(protocolName string, chainName string) error
- func (s *ProtocolInstanceStore) FindById(id int) (*ProtocolInstance, error)
- func (s *ProtocolInstanceStore) FindByProtocolIdAndChainId(protocolId int, chainId int) (*ProtocolInstance, error)
- func (s *ProtocolInstanceStore) FindChainById(id int) (*Chain, error)
- func (s *ProtocolInstanceStore) FindProtocolById(id int) (*Protocol, error)
- func (s *ProtocolInstanceStore) UpdateLastBlockRead(protocolInstanceId int, lastBlock uint) error
- func (s *ProtocolInstanceStore) UpdateProtocolInstance(protocolInstance *ProtocolInstance) (*ProtocolInstance, error)
- type ProtocolStore
- func (s *ProtocolStore) AddEventDefn(protocolName string, topicName string, topicHashHex string, ...) (*EventDefn, error)
- func (s *ProtocolStore) All() ([]*Protocol, error)
- func (s *ProtocolStore) AllByChain(chainId int) ([]*Protocol, error)
- func (s *ProtocolStore) AllEventsByProtocol(id int) ([]*EventDefn, error)
- func (s *ProtocolStore) AllEventsByProtocolAndTopicName(id int, topicName string) ([]*EventDefn, error)
- func (s *ProtocolStore) CreateProtocol(input NewProtocol) (*Protocol, error)
- func (s *ProtocolStore) DeleteByName(name string) error
- func (s *ProtocolStore) FindById(id int) (*Protocol, error)
- func (s *ProtocolStore) FindByName(name string) (*Protocol, error)
- func (s *ProtocolStore) FindEventById(id int) (*EventDefn, error)
- type RepayEvent
- type Stores
- type Token
- type TokenInfo
- type TokenStore
- func (s *TokenStore) All() ([]*Token, error)
- func (s *TokenStore) AllByChain(chainId int) ([]*Token, error)
- func (s *TokenStore) CreateToken(address string, name *string, ticker *string, chainId int) (*Token, error)
- func (s *TokenStore) FindById(id int) (*Token, error)
- func (s *TokenStore) FindByName(name string) (*Token, error)
- func (s *TokenStore) FindOrCreateByAddress(address string, chainId int) (*Token, error)
- func (s *TokenStore) UpdateToken(id int, address string, name string, ticker string, decimals int) (*Token, error)
- type UpdateProtocolInstance
Constants ¶
This section is empty.
Variables ¶
View Source
var AllEventType = []EventType{ EventTypeBorrow, EventTypeRepay, EventTypeLiquidation, EventTypeDeposit, }
Functions ¶
Types ¶
type AccountStore ¶
type AccountStore struct {
// contains filtered or unexported fields
}
func NewAccountStore ¶
func NewAccountStore(db *sqlx.DB) *AccountStore
func (*AccountStore) All ¶
func (s *AccountStore) All() ([]*Account, error)
func (*AccountStore) CreateAccount ¶
func (s *AccountStore) CreateAccount(address string) (*Account, error)
func (*AccountStore) FindByAddress ¶
func (s *AccountStore) FindByAddress(address string) (*Account, error)
func (*AccountStore) FindOrCreateByAddress ¶
func (s *AccountStore) FindOrCreateByAddress(address string) (*Account, error)
type AllEvent ¶
type AllEvent struct { // Common ID int Type EventType ProtocolInstanceId int EventDefinitionId int Txhash string Blocknumber int Index int OccuredAt time.Time // Borrow DepositorAccountId *int AmountDeposited *int DepositTokenId *int // Borrow BorrowerAccountId *int AmountBorrowed *int BorrowTokenId *int // Repay RepayerAccountId *int AmountRepayed *int RepayTokenId *int // Liquidation LiquidatorAccountId *int AmountSeized *int CollateralTokenId *int DebtTokenId *int }
func (AllEvent) AnyEvent ¶
func (e AllEvent) AnyEvent(accountStore *AccountStore, tokenStore *TokenStore) (AnyEvent, error)
type BorrowEvent ¶
type BorrowEvent struct { ID int `json:"id"` Type EventType `json:"type"` Txhash string `json:"txhash"` Blocknumber int `json:"blocknumber"` Index int `json:"index"` OccuredAt time.Time `json:"occuredAt"` Borrower *Account `json:"borrower"` AmountBorrowed int `json:"amountBorrowed"` Token *Token `json:"token"` }
func (BorrowEvent) IsAnyEvent ¶
func (BorrowEvent) IsAnyEvent()
func (BorrowEvent) IsEvent ¶
func (BorrowEvent) IsEvent()
type Chain ¶
type ChainStore ¶
type ChainStore struct {
// contains filtered or unexported fields
}
func NewChainStore ¶
func NewChainStore(db *sqlx.DB) *ChainStore
func (*ChainStore) All ¶
func (s *ChainStore) All() ([]*Chain, error)
func (*ChainStore) CreateChain ¶
func (s *ChainStore) CreateChain(input NewChain) (*Chain, error)
func (*ChainStore) DeleteByName ¶
func (s *ChainStore) DeleteByName(name string) error
func (*ChainStore) FindByName ¶
func (s *ChainStore) FindByName(name string) (*Chain, error)
type DepositEvent ¶
type DepositEvent struct { ID int `json:"id"` Type EventType `json:"type"` Txhash string `json:"txhash"` Blocknumber int `json:"blocknumber"` Index int `json:"index"` OccuredAt time.Time `json:"occuredAt"` Depositor *Account `json:"depositor"` AmountDeposited int `json:"amountDeposited"` Token *Token `json:"token"` }
func (DepositEvent) IsAnyEvent ¶
func (DepositEvent) IsAnyEvent()
func (DepositEvent) IsEvent ¶
func (DepositEvent) IsEvent()
type EventStore ¶
type EventStore struct {
// contains filtered or unexported fields
}
func NewEventStore ¶
func NewEventStore(db *sqlx.DB) *EventStore
func (*EventStore) AllByAccount ¶
func (s *EventStore) AllByAccount(accountId int) ([]AllEvent, error)
func (*EventStore) StoreBorrowEvent ¶
func (*EventStore) StoreDepositEvent ¶
func (*EventStore) StoreLiquidationEvent ¶
func (s *EventStore) StoreLiquidationEvent(protocolInstanceId int, eventDefinitionId int, txHash string, blockNumber int64, index int, occuredAt time.Time, borrowerAccountId int, liquidatorAccountId int, amountRepayed *big.Int, amountSeized *big.Int, debtTokenId int, collateralTokenId int) (int, error)
type EventType ¶
type EventType string
func (EventType) MarshalGQL ¶
func (*EventType) UnmarshalGQL ¶
type LiquidationEvent ¶
type LiquidationEvent struct { ID int `json:"id"` Type EventType `json:"type"` Txhash string `json:"txhash"` Blocknumber int `json:"blocknumber"` Index int `json:"index"` OccuredAt time.Time `json:"occuredAt"` Borrower *Account `json:"borrower"` Liquidator *Account `json:"liquidator"` AmountRepayed int `json:"amountRepayed"` AmountSeized int `json:"amountSeized"` CollateralToken *Token `json:"collateralToken"` DebtToken *Token `json:"debtToken"` }
func (LiquidationEvent) IsAnyEvent ¶
func (LiquidationEvent) IsAnyEvent()
func (LiquidationEvent) IsEvent ¶
func (LiquidationEvent) IsEvent()
type NewEventDefn ¶
type NewProtocol ¶
type NewProtocolInstance ¶
type ProtocolInstance ¶
type ProtocolInstance struct { ID int `json:"id"` Protocol *Protocol Chain *Chain ProtocolID int `json:"protocolId"` ChainID int `json:"chainId"` ContractAddress string `json:"contractAddress"` FirstBlockToRead int `json:"firstBlockToRead"` LastBlockRead int `json:"lastBlockRead"` }
func (*ProtocolInstance) ScanStartBlock ¶
func (pi *ProtocolInstance) ScanStartBlock() int
type ProtocolInstanceStore ¶
type ProtocolInstanceStore struct {
// contains filtered or unexported fields
}
func NewProtocolInstanceStore ¶
func NewProtocolInstanceStore(db *sqlx.DB) *ProtocolInstanceStore
func (*ProtocolInstanceStore) All ¶
func (s *ProtocolInstanceStore) All() ([]*ProtocolInstance, error)
func (*ProtocolInstanceStore) CreateProtocolInstance ¶
func (s *ProtocolInstanceStore) CreateProtocolInstance(input NewProtocolInstance) (*ProtocolInstance, error)
func (*ProtocolInstanceStore) DeleteByProtocolAndChain ¶
func (s *ProtocolInstanceStore) DeleteByProtocolAndChain(protocolName string, chainName string) error
func (*ProtocolInstanceStore) FindById ¶
func (s *ProtocolInstanceStore) FindById(id int) (*ProtocolInstance, error)
func (*ProtocolInstanceStore) FindByProtocolIdAndChainId ¶
func (s *ProtocolInstanceStore) FindByProtocolIdAndChainId(protocolId int, chainId int) (*ProtocolInstance, error)
func (*ProtocolInstanceStore) FindChainById ¶
func (s *ProtocolInstanceStore) FindChainById(id int) (*Chain, error)
func (*ProtocolInstanceStore) FindProtocolById ¶
func (s *ProtocolInstanceStore) FindProtocolById(id int) (*Protocol, error)
func (*ProtocolInstanceStore) UpdateLastBlockRead ¶
func (s *ProtocolInstanceStore) UpdateLastBlockRead(protocolInstanceId int, lastBlock uint) error
func (*ProtocolInstanceStore) UpdateProtocolInstance ¶
func (s *ProtocolInstanceStore) UpdateProtocolInstance(protocolInstance *ProtocolInstance) (*ProtocolInstance, error)
type ProtocolStore ¶
type ProtocolStore struct {
// contains filtered or unexported fields
}
func NewProtocolStore ¶
func NewProtocolStore(db *sqlx.DB) *ProtocolStore
func (*ProtocolStore) AddEventDefn ¶
func (*ProtocolStore) All ¶
func (s *ProtocolStore) All() ([]*Protocol, error)
func (*ProtocolStore) AllByChain ¶
func (s *ProtocolStore) AllByChain(chainId int) ([]*Protocol, error)
func (*ProtocolStore) AllEventsByProtocol ¶
func (s *ProtocolStore) AllEventsByProtocol(id int) ([]*EventDefn, error)
func (*ProtocolStore) AllEventsByProtocolAndTopicName ¶
func (s *ProtocolStore) AllEventsByProtocolAndTopicName(id int, topicName string) ([]*EventDefn, error)
func (*ProtocolStore) CreateProtocol ¶
func (s *ProtocolStore) CreateProtocol(input NewProtocol) (*Protocol, error)
func (*ProtocolStore) DeleteByName ¶
func (s *ProtocolStore) DeleteByName(name string) error
func (*ProtocolStore) FindByName ¶
func (s *ProtocolStore) FindByName(name string) (*Protocol, error)
func (*ProtocolStore) FindEventById ¶
func (s *ProtocolStore) FindEventById(id int) (*EventDefn, error)
type RepayEvent ¶
type RepayEvent struct { ID int `json:"id"` Type EventType `json:"type"` Txhash string `json:"txhash"` Blocknumber int `json:"blocknumber"` Index int `json:"index"` OccuredAt time.Time `json:"occuredAt"` Borrower *Account `json:"borrower"` AmountRepayed int `json:"amountRepayed"` Token *Token `json:"token"` }
func (RepayEvent) IsAnyEvent ¶
func (RepayEvent) IsAnyEvent()
func (RepayEvent) IsEvent ¶
func (RepayEvent) IsEvent()
type Stores ¶
type Stores struct { Protocol *ProtocolStore Chain *ChainStore ProtocolInstance *ProtocolInstanceStore Account *AccountStore Event *EventStore Token *TokenStore // contains filtered or unexported fields }
func GenerateStores ¶
type TokenStore ¶
type TokenStore struct {
// contains filtered or unexported fields
}
func NewTokenStore ¶
func NewTokenStore(db *sqlx.DB) *TokenStore
func (*TokenStore) All ¶
func (s *TokenStore) All() ([]*Token, error)
func (*TokenStore) AllByChain ¶
func (s *TokenStore) AllByChain(chainId int) ([]*Token, error)
func (*TokenStore) CreateToken ¶
func (*TokenStore) FindByName ¶
func (s *TokenStore) FindByName(name string) (*Token, error)
func (*TokenStore) FindOrCreateByAddress ¶
func (s *TokenStore) FindOrCreateByAddress(address string, chainId int) (*Token, error)
func (*TokenStore) UpdateToken ¶
Click to show internal directories.
Click to hide internal directories.