token

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Token

type Token struct {
	Symbol   string `json:"symbol"`
	Decimals int64  `json:"decimals"`

	TotalSupply *big.Int                             `json:"totalSupply"`
	Balances    map[string]*big.Int                  `json:"balances"` // account id -> balance
	Stakes      map[string]map[string][]schema.Stake `json:"stakes"`   // account id -> stake pool -> stakes
	// contains filtered or unexported fields
}

func New

func New(symbol string, decimals int64, totalSupply *big.Int, balances map[string]*big.Int, stakes map[string]map[string][]schema.Stake) *Token

func (*Token) BalanceOf

func (t *Token) BalanceOf(addr string) string

func (*Token) Info

func (t *Token) Info() *schema.TokenInfo

to avoid big.int json marshal loss accuracy

func (*Token) Stake

func (t *Token) Stake(from, stakePool string, amount *big.Int, stakedAt int64, feeRecipient string, fee *big.Int, dryRun bool) (err error)

func (*Token) TotalStaked

func (t *Token) TotalStaked(addr, stakePool string) string

func (*Token) Transfer

func (t *Token) Transfer(from, to string, amount *big.Int, feeRecipient string, fee *big.Int, dryRun bool) (err error)

func (*Token) TransferToStake

func (t *Token) TransferToStake(from, to string, amount *big.Int, stakePool string, stakedAt int64,
	feeRecipient string, fee *big.Int, dryRun bool) (err error)

func (*Token) Unstake

func (t *Token) Unstake(from, stakePool string, amount *big.Int, feeRecipient string, fee *big.Int, dryRun bool) (err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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