ethereum

package
v0.0.0-...-b2d66a9 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PAYMENT_GATE_SETTINGS = settings.LoadPaymentGateSettings()
	WEI_IN_ETH            = float64(1e18)
)

Functions

func ConfigureRouter

func ConfigureRouter(router *web.Router)

func SetupViews

func SetupViews()

func SweepEthereumWallet

func SweepEthereumWallet(addressFrom string, addressTo string)

func TaskUpdateEthereumWalletBalances

func TaskUpdateEthereumWalletBalances()

func UpdateEthereumWalletBalances

func UpdateEthereumWalletBalances()

func ViewCreateEthereumWallet

func ViewCreateEthereumWallet(w web.ResponseWriter, r *web.Request)

func ViewEthRPCGet

func ViewEthRPCGet(w web.ResponseWriter, r *web.Request)

func ViewListEthereumWalletsWithPositiveBalance

func ViewListEthereumWalletsWithPositiveBalance(w web.ResponseWriter, r *web.Request)

func ViewSendFromEthereumWallet

func ViewSendFromEthereumWallet(w web.ResponseWriter, r *web.Request)

func ViewShowEthereumWallet

func ViewShowEthereumWallet(w web.ResponseWriter, r *web.Request)

func ViewTableListEthereumWalletsWithPositiveBalance

func ViewTableListEthereumWalletsWithPositiveBalance(w web.ResponseWriter, r *web.Request)

Types

type DisplayEthereumWallet

type DisplayEthereumWallet struct {
	PublicKey string     `json:"address"`
	Balance   float64    `json:"balance"`
	UpdatedAt *time.Time `json:"updated_at,omitempty"`
	CreatedAt *time.Time `json:"created_at,omitempty"`
	Type      string     `json:"type"`
}

type ETHPayment

type ETHPayment struct {
	Address string  `json:"address"`
	Percent float64 `json:"percent"`
	Amount  float64 `json:"amount"`
}

type ETHPaymentResult

type ETHPaymentResult struct {
	Hash           string `json:"hash"`
	RawTx          string `json:"rawTransaction"`
	WalletFrom     string `json:"wallet_from"`
	WalletTo       string `json:"wallet_to"`
	Cost           uint64 `json:"cost"`
	Amount         uint64 `json:"amount"`
	Contract       string `json:"contract,omitempty"`
	ContractMethod string `json:"contract_method,omitempty"`
}

type EthereumWallet

type EthereumWallet struct {
	PublicKey  string `json:"address" gorm:"primary_key"`
	PrivateKey string `json:"private_key,omitempty" sql:"type:varchar(1024)"`

	Type string `json:"type"`

	CreatedAt *time.Time `json:"created_at" gorm:"index"`
	UpdatedAt *time.Time `json:"updated_at" gorm:"index"`
	DeletedAt *time.Time `json:"deleted_at" gorm:"index"`
}

func CreateEthereumWallet

func CreateEthereumWallet(tp string) (EthereumWallet, error)

func FindEthereumWalletByPublicKey

func FindEthereumWalletByPublicKey(publicKey string) (*EthereumWallet, error)

func GetAllEthereumWallets

func GetAllEthereumWallets() ([]EthereumWallet, error)

func (EthereumWallet) CurrentBalance

func (w EthereumWallet) CurrentBalance() (*EthereumWalletBalance, error)

func (EthereumWallet) Save

func (w EthereumWallet) Save() error

func (EthereumWallet) SaveToDatabase

func (w EthereumWallet) SaveToDatabase() error

func (EthereumWallet) Transfer

func (w EthereumWallet) Transfer(payments []ETHPayment) (ETHPaymentResult, error)

func (EthereumWallet) UpdateBalance

func (w EthereumWallet) UpdateBalance() (*EthereumWalletBalance, error)

func (EthereumWallet) Validate

func (w EthereumWallet) Validate() error

type EthereumWalletBalance

type EthereumWalletBalance struct {
	ID             int            `json:"id" gorm:"primary_key"`
	PublicKey      string         `json:"address" gorm:"index"`
	BalanceETH     float64        `json:"balance`
	EthereumWallet EthereumWallet `json:"-" gorm:"ForeignKey:PublicKey;AssociationForeignKey:PublicKey"`

	CreatedAt *time.Time `json:"created_at" gorm:"index"`
	UpdatedAt *time.Time `json:"updated_at" gorm:"index"`
	DeletedAt *time.Time `json:"deleted_at" gorm:"index"`
}

func FindEthereumWalletsWithNonZeroBalance

func FindEthereumWalletsWithNonZeroBalance() ([]EthereumWalletBalance, error)

func (EthereumWalletBalance) DisplayEthereumWallet

func (w EthereumWalletBalance) DisplayEthereumWallet() DisplayEthereumWallet

func (EthereumWalletBalance) Save

func (w EthereumWalletBalance) Save() error

type EthereumWallets

type EthereumWallets []EthereumWallet

type ViewListEthereumWalletsWithPositiveBalanceResponse

type ViewListEthereumWalletsWithPositiveBalanceResponse struct {
	DisplayEthereumWallets []DisplayEthereumWallet `json:"wallets"`
	SummaryBalance         float64                 `json:"balance"`
}

Jump to

Keyboard shortcuts

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