Documentation ¶
Index ¶
- Constants
- func ETHListener(eth *contracts.ETHManager, ethEvents chan<- *ETHEvent, errChan chan<- error, ...)
- func GenerateAndWatchRegistry(errChan chan<- error)
- func ListenAndRetweet(errChan chan<- error)
- func ProcessETHEvents(eth *contracts.ETHManager, eventChan <-chan *ETHEvent, errChan chan<- error)
- func ProcessTwitterEvents(eth *contracts.ETHManager, eventChan <-chan *TwitterEvent, ...)
- func ScheduleUpdates(eth *contracts.ETHManager, errChan chan<- error)
- func StartBotListener(eth *contracts.ETHManager, ethEvents chan<- *ETHEvent, errChan chan<- error)
- func StartScannerListener(eth *contracts.ETHManager, ethEvents chan<- *ETHEvent, errChan chan<- error)
- func UpdateBalances(errChan chan<- error)
- type ETHEvent
- type RegistrationEventData
- type TwitterEvent
- type WatchedContractGenerator
Constants ¶
const ( TwitterEventTypeMention twitterEventType = "EventTypeMention" TwitterEventTypeDM twitterEventType = "EventTypeDM" TwitterEventTypeVote twitterEventType = "EventTypeVote" TwitterEventTypePollCompleted twitterEventType = "EventTypePollCompleted" TwitterEventTypeFollow twitterEventType = "EventTypeFollow" // ETHEventNewMultisigWallet is triggered when the multisig wallet factory instantiates a new wallet ETHEventNewMultisigWallet = "ContractInstantiation" ETHEventNewMultisigSubmission = "Submission" ETHEventNewTCRApplication = "_Application" ETHEventNewTCRChallenge = "_Challenge" ETHEventTCRDeposit = "_Deposit" ETHEventTCRWithdrawal = "_Withdrawal" ETHEventTCRApplicationWhitelisted = "_ApplicationWhitelisted" ETHEventTCRApplicationRemoved = "_ApplicationRemoved" ETHEventTCRListingRemoved = "_ListingRemoved" ETHEventTCRListingWithdrawn = "_ListingWithdrawn" ETHEventTCRTouchAndRemoved = "_TouchAndRemoved" ETHEventTCRChallengeFailed = "_ChallengeFailed" ETHEventTCRChallengeSucceeded = "_ChallengeSucceeded" ETHEventTCRRewardClaimed = "_RewardClaimed" ETHEventTCRExitInitialized = "_ExitInitialized" ETHEventTokenTransfer = "Transfer" ETHEventTokenApproval = "Approval" ETHEventTokenMint = "Mint" ETHEventTokenMintFinished = "MintFinished" ETHEventPLCRVoteCommitted = "_VoteCommitted" ETHEventPLCRPollCreated = "_PollCreated" ETHEventPLCRVoteRevealed = "_VoteRevealed" ETHEventPLCRVotingRightsGranted = "_VotingRightsGranted" ETHEventPLCRVotingRightsWithdrawn = "_VotingRightsWithdrawn" ETHEventPLCRTokensRescued = "_TokensRescued" )
Variables ¶
This section is empty.
Functions ¶
func ETHListener ¶
func ETHListener(eth *contracts.ETHManager, ethEvents chan<- *ETHEvent, errChan chan<- error, generateContracts WatchedContractGenerator, lastSyncedKey string)
ETHListener begins listening for relevant events on the ETH blockchain
func GenerateAndWatchRegistry ¶
func GenerateAndWatchRegistry(errChan chan<- error)
GenerateAndWatchRegistry incrementally syncs the registry_* tables with events from the eth_events table in order to form an up-to-date state of the registry
func ListenAndRetweet ¶
func ListenAndRetweet(errChan chan<- error)
ListenAndRetweet listens for all tweets by users who are on the TCR and retweets onto @TCRParty's timeline. It will also poll for updates on the eth_events table and reset the twitter filter upon hearing of an addition/removal of a listing on the TCR
func ProcessETHEvents ¶
func ProcessETHEvents(eth *contracts.ETHManager, eventChan <-chan *ETHEvent, errChan chan<- error)
ProcessETHEvents listens for blockchain events and fires a corresponding handler
func ProcessTwitterEvents ¶
func ProcessTwitterEvents(eth *contracts.ETHManager, eventChan <-chan *TwitterEvent, errorChan chan<- error)
ProcessTwitterEvents listens for twitter events and fires of a corresponding handler
func ScheduleUpdates ¶
func ScheduleUpdates(eth *contracts.ETHManager, errChan chan<- error)
ScheduleUpdates finds new/existing applications/challenge polls and schedules tasks to fire their on-chain updater functions once they have matured. Example: calling updateStatus on an application once the application period has passed.
func StartBotListener ¶
func StartBotListener(eth *contracts.ETHManager, ethEvents chan<- *ETHEvent, errChan chan<- error)
StartBotListener starts ETHListener, passing in the set of contracts needed for the bot to operate
func StartScannerListener ¶
func StartScannerListener(eth *contracts.ETHManager, ethEvents chan<- *ETHEvent, errChan chan<- error)
StartScannerListener starts ETH Listener, passing in all contracts that make up the TCR for logging purposes.
func UpdateBalances ¶
func UpdateBalances(errChan chan<- error)
UpdateBalances polls for new eth events and updates the balances table whenever relevant eth events are found.
Types ¶
type ETHEvent ¶
type ETHEvent struct { EventType string CreatedAt *time.Time BlockNumber uint64 TxIndex uint LogIndex uint TxHash string Data []byte Topics []common.Hash }
ETHEvent represents an incoming event from the blockchain
type RegistrationEventData ¶
type RegistrationEventData struct { Event *TwitterEvent Challenge *models.RegistrationChallengeRegistrationQuestion Account *models.Account }
RegistrationEventData collects the required data for keeping track of the user registration flow into a struct
type TwitterEvent ¶
type TwitterEvent struct { EventType twitterEventType // type of event Time time.Time // timestamp ObjectID string // ID of incoming event's object (ie a tweet ID for a mention) SourceHandle string // twitter handle sending SourceID int64 // twitter ID of the handle Message string // whole message }
TwitterEvent represents an incoming event from Twitter
type WatchedContractGenerator ¶
type WatchedContractGenerator func(eth *contracts.ETHManager) ([]*watchedContract, error)
WatchedContractGenerator is a function that should be passed into ETHListener to generate a list of contracts that need to be watched.