Documentation ¶
Overview ¶
Package bank represents all the transactions necessary for the game.
Index ¶
- type Bank
- func (b *Bank) AccountBalance(ctx context.Context, accountID common.Address) (GWei *big.Float, err error)
- func (b *Bank) Balance(ctx context.Context) (GWei *big.Float, err error)
- func (b *Bank) Client() *ethereum.Client
- func (b *Bank) ContractID() common.Address
- func (b *Bank) Deposit(ctx context.Context, amountGWei *big.Float) (*types.Transaction, *types.Receipt, error)
- func (b *Bank) EthereumBalance(ctx context.Context) (wei *big.Int, err error)
- func (b *Bank) Reconcile(ctx context.Context, winningAccountID common.Address, ...) (*types.Transaction, *types.Receipt, error)
- func (b *Bank) Withdraw(ctx context.Context) (*types.Transaction, *types.Receipt, error)
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) ContractID ¶
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 ¶
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.