Documentation
¶
Overview ¶
Package biz is a generated GoMock package.
Index ¶
- type BacktestService
- type Campaign
- func (c *Campaign) AddTask(task *Task) error
- func (c *Campaign) Complete() error
- func (c *Campaign) GetSharePoolTaskReward() []*model.Reward
- func (c *Campaign) GetTaskByType(taskType model.TaskType) *Task
- func (c *Campaign) HasCompletedOnboardingTask(volume float64) bool
- func (c *Campaign) MarshalBSON() ([]byte, error)
- func (c *Campaign) OnSwapExecuted(tx *Transaction) (*model.Reward, error)
- func (c *Campaign) Start() error
- func (c *Campaign) Tasks() []*Task
- func (c *Campaign) UnmarshalBSON(bytes []byte) error
- type CampaignService
- type MockBacktestService
- type MockBacktestServiceMockRecorder
- type MockCampaignService
- type MockCampaignServiceMockRecorder
- type MockRewardService
- type MockRewardServiceMockRecorder
- type MockTaskService
- type MockTaskServiceMockRecorder
- type MockTransactionService
- type MockTransactionServiceMockRecorder
- type MockUserService
- type MockUserServiceMockRecorder
- type Reward
- type RewardRedeemedEvent
- type RewardService
- type SwapExecutedEvent
- type SwapExecutedPayload
- type Task
- type TaskService
- type Transaction
- func (x *Transaction) GetSwapAmountByTokenAddress(tokenAddress string) string
- func (x *Transaction) GetSwapForPool(poolAddress common.Address, swapEventHash common.Hash) (*model.SwapDetail, error)
- func (x *Transaction) GetTransaction() *model.Transaction
- func (x *Transaction) IsSwapType() bool
- func (x *Transaction) SwapUSDCAmount() string
- func (x *Transaction) Timestamp() time.Time
- func (x *Transaction) TxHash() string
- func (x *Transaction) WithReceipt(receipt *types.Receipt) *Transaction
- func (x *Transaction) WithStatus(status model.TransactionStatus) *Transaction
- type TransactionList
- type TransactionService
- type User
- type UserService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BacktestService ¶
type BacktestService interface { // RunBacktest executes a backtest for a campaign within a specified time range. RunBacktest(c context.Context, campaign *Campaign, resultCh chan<- *model.Reward) error }
BacktestService defines the domain logic for backtesting campaigns with historical data.
type Campaign ¶
Campaign represents the aggregate root for campaigns.
func NewCampaign ¶
NewCampaign creates a new Campaign aggregate.
func (*Campaign) GetSharePoolTaskReward ¶
GetSharePoolTaskReward returns the rewards for the share pool task.
func (*Campaign) GetTaskByType ¶
GetTaskByType returns the task of the specified type.
func (*Campaign) HasCompletedOnboardingTask ¶
HasCompletedOnboardingTask checks if the user has completed the onboarding task.
func (*Campaign) MarshalBSON ¶
func (*Campaign) OnSwapExecuted ¶
func (c *Campaign) OnSwapExecuted(tx *Transaction) (*model.Reward, error)
OnSwapExecuted handles the swap executed event.
func (*Campaign) UnmarshalBSON ¶
type CampaignService ¶
type CampaignService interface { // CreateCampaign initializes a new campaign. CreateCampaign( c context.Context, name string, startAt time.Time, mode model.CampaignMode, targetPool string, minAmount float64, ) (*Campaign, error) }
CampaignService defines the domain logic for campaign management.
type MockBacktestService ¶
type MockBacktestService struct {
// contains filtered or unexported fields
}
MockBacktestService is a mock of BacktestService interface.
func NewMockBacktestService ¶
func NewMockBacktestService(ctrl *gomock.Controller) *MockBacktestService
NewMockBacktestService creates a new mock instance.
func (*MockBacktestService) EXPECT ¶
func (m *MockBacktestService) EXPECT() *MockBacktestServiceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockBacktestService) RunBacktest ¶
func (m *MockBacktestService) RunBacktest(c context.Context, campaign *Campaign, resultCh chan<- *model.Reward) error
RunBacktest mocks base method.
type MockBacktestServiceMockRecorder ¶
type MockBacktestServiceMockRecorder struct {
// contains filtered or unexported fields
}
MockBacktestServiceMockRecorder is the mock recorder for MockBacktestService.
func (*MockBacktestServiceMockRecorder) RunBacktest ¶
func (mr *MockBacktestServiceMockRecorder) RunBacktest(c, campaign, resultCh any) *gomock.Call
RunBacktest indicates an expected call of RunBacktest.
type MockCampaignService ¶
type MockCampaignService struct {
// contains filtered or unexported fields
}
MockCampaignService is a mock of CampaignService interface.
func NewMockCampaignService ¶
func NewMockCampaignService(ctrl *gomock.Controller) *MockCampaignService
NewMockCampaignService creates a new mock instance.
func (*MockCampaignService) CreateCampaign ¶
func (m *MockCampaignService) CreateCampaign(c context.Context, name string, startAt time.Time, mode model.CampaignMode, targetPool string, minAmount float64) (*Campaign, error)
CreateCampaign mocks base method.
func (*MockCampaignService) EXPECT ¶
func (m *MockCampaignService) EXPECT() *MockCampaignServiceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockCampaignServiceMockRecorder ¶
type MockCampaignServiceMockRecorder struct {
// contains filtered or unexported fields
}
MockCampaignServiceMockRecorder is the mock recorder for MockCampaignService.
func (*MockCampaignServiceMockRecorder) CreateCampaign ¶
func (mr *MockCampaignServiceMockRecorder) CreateCampaign(c, name, startAt, mode, targetPool, minAmount any) *gomock.Call
CreateCampaign indicates an expected call of CreateCampaign.
type MockRewardService ¶
type MockRewardService struct {
// contains filtered or unexported fields
}
MockRewardService is a mock of RewardService interface.
func NewMockRewardService ¶
func NewMockRewardService(ctrl *gomock.Controller) *MockRewardService
NewMockRewardService creates a new mock instance.
func (*MockRewardService) EXPECT ¶
func (m *MockRewardService) EXPECT() *MockRewardServiceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockRewardServiceMockRecorder ¶
type MockRewardServiceMockRecorder struct {
// contains filtered or unexported fields
}
MockRewardServiceMockRecorder is the mock recorder for MockRewardService.
type MockTaskService ¶
type MockTaskService struct {
// contains filtered or unexported fields
}
MockTaskService is a mock of TaskService interface.
func NewMockTaskService ¶
func NewMockTaskService(ctrl *gomock.Controller) *MockTaskService
NewMockTaskService creates a new mock instance.
func (*MockTaskService) CreateTask ¶
func (m *MockTaskService) CreateTask(c context.Context, campaign *Campaign, name, description string, taskType model.TaskType, minAmount float64, poolID string) (*Task, error)
CreateTask mocks base method.
func (*MockTaskService) EXPECT ¶
func (m *MockTaskService) EXPECT() *MockTaskServiceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockTaskServiceMockRecorder ¶
type MockTaskServiceMockRecorder struct {
// contains filtered or unexported fields
}
MockTaskServiceMockRecorder is the mock recorder for MockTaskService.
func (*MockTaskServiceMockRecorder) CreateTask ¶
func (mr *MockTaskServiceMockRecorder) CreateTask(c, campaign, name, description, taskType, minAmount, poolID any) *gomock.Call
CreateTask indicates an expected call of CreateTask.
type MockTransactionService ¶
type MockTransactionService struct {
// contains filtered or unexported fields
}
MockTransactionService is a mock of TransactionService interface.
func NewMockTransactionService ¶
func NewMockTransactionService(ctrl *gomock.Controller) *MockTransactionService
NewMockTransactionService creates a new mock instance.
func (*MockTransactionService) EXPECT ¶
func (m *MockTransactionService) EXPECT() *MockTransactionServiceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockTransactionService) ProcessTransaction ¶
func (m *MockTransactionService) ProcessTransaction(ctx context.Context, transaction *Transaction, user *User, task *Task) error
ProcessTransaction mocks base method.
type MockTransactionServiceMockRecorder ¶
type MockTransactionServiceMockRecorder struct {
// contains filtered or unexported fields
}
MockTransactionServiceMockRecorder is the mock recorder for MockTransactionService.
func (*MockTransactionServiceMockRecorder) ProcessTransaction ¶
func (mr *MockTransactionServiceMockRecorder) ProcessTransaction(ctx, transaction, user, task any) *gomock.Call
ProcessTransaction indicates an expected call of ProcessTransaction.
type MockUserService ¶
type MockUserService struct {
// contains filtered or unexported fields
}
MockUserService is a mock of UserService interface.
func NewMockUserService ¶
func NewMockUserService(ctrl *gomock.Controller) *MockUserService
NewMockUserService creates a new mock instance.
func (*MockUserService) EXPECT ¶
func (m *MockUserService) EXPECT() *MockUserServiceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockUserService) GetUserTaskListByAddress ¶
func (m *MockUserService) GetUserTaskListByAddress(c context.Context, address string) (*User, error)
GetUserTaskListByAddress mocks base method.
type MockUserServiceMockRecorder ¶
type MockUserServiceMockRecorder struct {
// contains filtered or unexported fields
}
MockUserServiceMockRecorder is the mock recorder for MockUserService.
func (*MockUserServiceMockRecorder) GetUserTaskListByAddress ¶
func (mr *MockUserServiceMockRecorder) GetUserTaskListByAddress(c, address any) *gomock.Call
GetUserTaskListByAddress indicates an expected call of GetUserTaskListByAddress.
type RewardRedeemedEvent ¶
type RewardRedeemedEvent struct { }
RewardRedeemedEvent is the event for reward redeemed.
type RewardService ¶
type RewardService interface { }
RewardService defines the domain logic for rewards and point allocation.
type SwapExecutedEvent ¶
type SwapExecutedEvent struct {
// contains filtered or unexported fields
}
SwapExecutedEvent is the event for swap executed.
func NewSwapExecutedEvent ¶
func NewSwapExecutedEvent(occurredAt time.Time, payload SwapExecutedPayload) *SwapExecutedEvent
NewSwapExecutedEvent creates a new SwapExecutedEvent instance.
func (*SwapExecutedEvent) GetID ¶
func (e *SwapExecutedEvent) GetID() string
func (*SwapExecutedEvent) GetName ¶
func (e *SwapExecutedEvent) GetName() string
func (*SwapExecutedEvent) GetOccurredAt ¶
func (e *SwapExecutedEvent) GetOccurredAt() time.Time
func (*SwapExecutedEvent) GetPayload ¶
func (e *SwapExecutedEvent) GetPayload() interface{}
type SwapExecutedPayload ¶
type SwapExecutedPayload struct {
TxID string
}
SwapExecutedPayload is the payload for swap executed.
type Task ¶
type Task struct { model.Task `bson:",inline"` CampaignID string `bson:"campaign_id"` Progress int `bson:"progress"` }
Task is an aggregate root that represents the task.
func NewTask ¶
func NewTask( name, description string, taskType model.TaskType, minAmount float64, poolID string, ) (*Task, error)
NewTask creates a new Task aggregate.
func NewTaskOfOnboarding ¶
NewTaskOfOnboarding creates a new Task aggregate for onboarding.
func NewTaskOfSharePool ¶
NewTaskOfSharePool creates a new Task aggregate for sharing a pool.
func (*Task) CalculateProgress ¶
CalculateProgress calculates the progress of a task based on the given amount.
type TaskService ¶
type TaskService interface { // CreateTask creates a new task in the system. CreateTask( c context.Context, campaign *Campaign, name, description string, taskType model.TaskType, minAmount float64, poolID string, ) (*Task, error) }
TaskService provides operations related to task management.
type Transaction ¶
type Transaction struct { SwapDetail *model.SwapDetail // contains filtered or unexported fields }
Transaction is an aggregate root that represents the transaction.
func NewTransaction ¶
func NewTransaction(txHash, from, to string, blockNumber int64, ts time.Time) *Transaction
NewTransaction is used to create a new transaction.
func (*Transaction) GetSwapAmountByTokenAddress ¶
func (x *Transaction) GetSwapAmountByTokenAddress(tokenAddress string) string
GetSwapAmountByTokenAddress is used to get the swap amount by token address.
func (*Transaction) GetSwapForPool ¶
func (x *Transaction) GetSwapForPool(poolAddress common.Address, swapEventHash common.Hash) (*model.SwapDetail, error)
GetSwapForPool is used to get the swap for the pool.
func (*Transaction) GetTransaction ¶
func (x *Transaction) GetTransaction() *model.Transaction
GetTransaction is used to get the transaction.
func (*Transaction) IsSwapType ¶
func (x *Transaction) IsSwapType() bool
IsSwapType is used to check if the transaction is swap executed.
func (*Transaction) SwapUSDCAmount ¶
func (x *Transaction) SwapUSDCAmount() string
SwapUSDCAmount is used to get the swap usdc amount.
func (*Transaction) Timestamp ¶
func (x *Transaction) Timestamp() time.Time
Timestamp is used to get the timestamp.
func (*Transaction) TxHash ¶
func (x *Transaction) TxHash() string
TxHash is used to get the transaction hash.
func (*Transaction) WithReceipt ¶
func (x *Transaction) WithReceipt(receipt *types.Receipt) *Transaction
WithReceipt is used to set the receipt.
func (*Transaction) WithStatus ¶
func (x *Transaction) WithStatus(status model.TransactionStatus) *Transaction
WithStatus is used to set the status.
type TransactionList ¶
type TransactionList []*Transaction
TransactionList is a list of transactions.
type TransactionService ¶
type TransactionService interface { // ProcessTransaction processes a transaction and updates the user's progress. ProcessTransaction(ctx context.Context, transaction *Transaction, user *User, task *Task) error }
TransactionService defines the domain logic for processing transactions.
type User ¶
type User struct { model.User Tasks []*Task `json:"tasks,omitempty"` Rewards []*Reward `json:"rewards,omitempty"` Transactions TransactionList `json:"transactions,omitempty"` // contains filtered or unexported fields }
User is an aggregate root that represents the user.
func (*User) OnSwapExecuted ¶
func (x *User) OnSwapExecuted(ctx contextx.Contextx, tx *Transaction) error
OnSwapExecuted is called when a swap transaction is executed.