bank

package
v0.0.0-...-25770c3 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package bank represents all the transactions necessary for the game.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bank

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

Bank represents a bank that allows for the reconciling of a game and information about account balances.

func New

func New(ctx context.Context, log *logger.Logger, backend ethereum.Backend, privateKey *ecdsa.PrivateKey, contractID common.Address) (*Bank, error)

New returns a new bank with the ability to manage the game money.

func (*Bank) AccountBalance

func (b *Bank) AccountBalance(ctx context.Context, accountID common.Address) (GWei *big.Float, err error)

AccountBalance will return the bank balance for the specified account. Only the owner of the smart contract can make this call.

func (*Bank) Balance

func (b *Bank) Balance(ctx context.Context) (GWei *big.Float, err error)

Balance will return the bank balance for the connected account.

func (*Bank) Client

func (b *Bank) Client() *ethereum.Client

Client returns the underlying contract client.

func (*Bank) ContractID

func (b *Bank) ContractID() common.Address

ContractID returns contract id in use.

func (*Bank) Deposit

func (b *Bank) Deposit(ctx context.Context, amountGWei *big.Float) (*types.Transaction, *types.Receipt, error)

Deposit will add the given amount to the account's contract balance.

func (*Bank) EthereumBalance

func (b *Bank) EthereumBalance(ctx context.Context) (wei *big.Int, err error)

EthereumBalance returns the ethereum balance for the connected account.

func (*Bank) Reconcile

func (b *Bank) Reconcile(ctx context.Context, winningAccountID common.Address, losingAccountIDs []common.Address, anteGWei *big.Float, gameFeeGWei *big.Float) (*types.Transaction, *types.Receipt, error)

Reconcile will apply with ante to the winner and loser accounts, plus provide the house the game fee.

func (*Bank) Withdraw

func (b *Bank) Withdraw(ctx context.Context) (*types.Transaction, *types.Receipt, error)

Withdraw will move all the account's balance in the contract, to the account's wallet.

Jump to

Keyboard shortcuts

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