mock

package
v0.0.0-...-a76a30e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 2, 2025 License: Apache-2.0, MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewVault

func NewVault(opts ...Option) vault.Service

NewVault creates the mock vault implementation

Types

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option is the option passed to the mock Vault service

func WithCheckBalanceFunc

func WithCheckBalanceFunc(f func(bal *big.Int) (err error)) Option

func WithGetWithdrawTimeFunc

func WithGetWithdrawTimeFunc(f func(ctx context.Context) (ti *big.Int, err error)) Option

func WithLastChequeFunc

func WithLastChequeFunc(f func(beneficiary common.Address, token common.Address) (*vault.SignedCheque, error)) Option

func WithLastChequesFunc

func WithLastChequesFunc(f func(token common.Address) (map[common.Address]*vault.SignedCheque, error)) Option

func WithLiquidBalanceFunc

func WithLiquidBalanceFunc(f func(ctx context.Context) (ti *big.Int, err error)) Option

func WithTotalBalanceFunc

func WithTotalBalanceFunc(f func(ctx context.Context, token common.Address) (ti *big.Int, err error)) Option

func WithTotalDailyReceivedCashedFunc

func WithTotalDailyReceivedCashedFunc(f func(token common.Address) (*big.Int, error)) Option

func WithTotalDailyReceivedFunc

func WithTotalDailyReceivedFunc(f func(token common.Address) (*big.Int, error)) Option

func WithTotalIssuedCountFunc

func WithTotalIssuedCountFunc(f func(token common.Address) (int, error)) Option

func WithTotalIssuedFunc

func WithTotalIssuedFunc(f func(token common.Address) (*big.Int, error)) Option

func WithTotalPaidOutFunc

func WithTotalPaidOutFunc(f func(ctx context.Context, token common.Address) (ti *big.Int, err error)) Option

func WithTotalReceivedCashedCountFunc

func WithTotalReceivedCashedCountFunc(f func(token common.Address) (int, error)) Option

func WithTotalReceivedCashedFunc

func WithTotalReceivedCashedFunc(f func(token common.Address) (*big.Int, error)) Option

func WithTotalReceivedCountFunc

func WithTotalReceivedCountFunc(f func(token common.Address) (int, error)) Option

func WithTotalReceivedFunc

func WithTotalReceivedFunc(f func(token common.Address) (*big.Int, error)) Option

func WithVaultAddressFunc

func WithVaultAddressFunc(f func() common.Address) Option

func WithVaultAvailableBalanceFunc

func WithVaultAvailableBalanceFunc(f func(ctx context.Context, token common.Address) (*big.Int, error)) Option

func WithVaultBalanceFunc

func WithVaultBalanceFunc(f func(ctx context.Context) (*big.Int, error)) Option

WithVault*Functions set the mock vault functions

func WithVaultDepositFunc

func WithVaultDepositFunc(f func(ctx context.Context, amount *big.Int, token common.Address) (hash common.Hash, err error)) Option

func WithVaultIssueFunc

func WithVaultIssueFunc(f func(ctx context.Context, beneficiary common.Address, amount *big.Int, token common.Address, sendChequeFunc vault.SendChequeFunc) (*big.Int, error)) Option

func WithVaultWithdrawFunc

func WithVaultWithdrawFunc(f func(ctx context.Context, amount *big.Int, token common.Address) (hash common.Hash, err error)) Option

func WithWaitForDepositFunc

func WithWaitForDepositFunc(f func(ctx context.Context, txHash common.Hash) error) Option

func WithWbttBalanceFunc

func WithWbttBalanceFunc(f func(ctx context.Context, add common.Address) (bal *big.Int, err error)) Option

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service is the mock vault service.

func (*Service) Address

func (s *Service) Address() common.Address

Address mocks the vault .Address function

func (*Service) AvailableBalance

func (s *Service) AvailableBalance(ctx context.Context, token common.Address) (bal *big.Int, err error)

func (*Service) BTTBalanceOf

func (s *Service) BTTBalanceOf(ctx context.Context, add common.Address, block *big.Int) (bal *big.Int, err error)

func (*Service) Balance

func (s *Service) Balance(ctx context.Context) (bal *big.Int, err error)

Balance mocks the vault .Balance function

func (*Service) CheckBalance

func (s *Service) CheckBalance(bal *big.Int) (err error)

func (*Service) Deposit

func (s *Service) Deposit(ctx context.Context, amount *big.Int, token common.Address) (hash common.Hash, err error)

Deposit mocks the vault .Deposit function

func (*Service) GetWithdrawTime

func (s *Service) GetWithdrawTime(ctx context.Context) (ti *big.Int, err error)

func (*Service) Issue

func (s *Service) Issue(ctx context.Context, beneficiary common.Address, amount *big.Int, token common.Address, sendChequeFunc vault.SendChequeFunc) (*big.Int, error)

func (*Service) LastCheque

func (s *Service) LastCheque(beneficiary common.Address, token common.Address) (*vault.SignedCheque, error)

func (*Service) LastCheques

func (s *Service) LastCheques(token common.Address) (map[common.Address]*vault.SignedCheque, error)

func (*Service) LiquidBalance

func (s *Service) LiquidBalance(ctx context.Context) (ti *big.Int, err error)

func (*Service) TokenBalanceOf

func (s *Service) TokenBalanceOf(ctx context.Context, addr common.Address, tokenStr string) (*big.Int, error)

func (*Service) TotalBalance

func (s *Service) TotalBalance(ctx context.Context, token common.Address) (ti *big.Int, err error)

func (*Service) TotalDailyReceived

func (s *Service) TotalDailyReceived(token common.Address) (*big.Int, error)

func (*Service) TotalDailyReceivedCashed

func (s *Service) TotalDailyReceivedCashed(token common.Address) (*big.Int, error)

func (*Service) TotalIssued

func (s *Service) TotalIssued(token common.Address) (*big.Int, error)

func (*Service) TotalIssuedCount

func (s *Service) TotalIssuedCount(token common.Address) (ti int, err error)

func (*Service) TotalPaidOut

func (s *Service) TotalPaidOut(ctx context.Context, token common.Address) (ti *big.Int, err error)

func (*Service) TotalReceived

func (s *Service) TotalReceived(token common.Address) (*big.Int, error)

func (*Service) TotalReceivedCashed

func (s *Service) TotalReceivedCashed(token common.Address) (*big.Int, error)

func (*Service) TotalReceivedCashedCount

func (s *Service) TotalReceivedCashedCount(token common.Address) (int, error)

func (*Service) TotalReceivedCount

func (s *Service) TotalReceivedCount(token common.Address) (int, error)

func (*Service) UpgradeTo

func (s *Service) UpgradeTo(ctx context.Context, newVaultImpl common.Address) (old, new common.Address, err error)

func (*Service) WBTTBalanceOf

func (s *Service) WBTTBalanceOf(ctx context.Context, add common.Address) (bal *big.Int, err error)

func (*Service) WaitForDeposit

func (s *Service) WaitForDeposit(ctx context.Context, txHash common.Hash) error

func (*Service) Withdraw

func (s *Service) Withdraw(ctx context.Context, amount *big.Int, token common.Address) (hash common.Hash, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL